- Home /
Question by
gordeszkakerek · Jan 04, 2012 at 01:22 PM ·
androidraycasttouchlevel
Android Touch Cube on screen , level To Load
I search for 6 days on forums but I can't do this: I have a 3d object, for example a Cube on the screen. If I touch this, load a new level. They written It's easy with raycast. But I dont know raycast. Please help.
Comment
Answer by michielbos · Jul 13, 2012 at 07:09 PM
I don't have much experience with raycast, but something like this might work:
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100))
Debug.DrawLine (ray.origin, hit.point);
if (hit.transform.name == "The Cube's Name...")
Application.LoadLevel(1);
Your answer
Follow this Question
Related Questions
Android Unable to track finger touch after orientation change 0 Answers
If you help me, i make you 3d object 1 Answer
raycasting and layermask question 2 Answers
i need help in walking character in android, using raycast where user touches? 0 Answers
Detect touch lifted from object regardless of lift location 0 Answers