- Home /
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!
Answer by Meltdown · Sep 19, 2011 at 04:51 PM
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.
Well, with the PC or $$anonymous$$ac, I can create a basic JS file with an "On$$anonymous$$ouseDown" 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.
Your answer
Follow this Question
Related Questions
Touch joystick tutorials ? 0 Answers
input touch android help 0 Answers
Detect if finger lifted off screen 1 Answer
Touch Input madness 2 Answers
Touch Input in Android... 1 Answer