x


Need Android Help - How do I click and mouseover a 3d object?

I would like to know how to set it up so when the user is holding their finger on the screen and their finger is over a certain object, that object will light up and if the finger slides off that object, it is no longer lit. If the finger is lifted off the screen while an object is lit up, then it becomes selected as if "touched" or "clicked". (aka "Touch Screen Mouse-over")

I already have code in place for the PC version to where I am using "OnMouseEnter", "OnMouseLeave", etc. Are there equivalent built-in functions for mobile touch screen controls? If not, should I setup a raycast system or is there a better method?

I should probably mention, I need the code in JS, not CS. Thanks!

more ▼

asked Sep 19 '11 at 05:46 AM

kingdutka gravatar image

kingdutka
61 6 7 8

Urgently needed...

Sep 19 '11 at 04:39 PM kingdutka
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Take a look at how Unity handles Mobile Input

You can get access to an array of Input.Touches, and determine from those touches and gesture phases what exactly the user is doing.

more ▼

answered Sep 19 '11 at 04:51 PM

Meltdown gravatar image

Meltdown
5.6k 18 25 49

Well, with the PC or Mac, I can create a basic JS file with an "OnMouseDown" function and drop that script onto say an NPC character. Then whenever the player clicks on that NPC, it does whatever I want.

I need basically the "touchscreen version" of that and I'm having trouble accessing the NPC from a raycast.

Sep 20 '11 at 04:48 AM kingdutka
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2457
x952
x577
x90
x6

asked: Sep 19 '11 at 05:46 AM

Seen: 1487 times

Last Updated: Sep 20 '11 at 04:48 AM