Im trying to get my interface to respond to a user touch, and I must be missing something as it doesnt work! Yet the debugDraw lines draws exactly where I want to go (See attached image). Ive also tried it with Input.mousePosition. Im using the RaycastAll as the mesh I want to collide with is under a gameObject that I will eventually add at the touch position.
m_touchPosition is a Vector3
My code is below. Im a new user, but very keen to get into the big wide world of Unity! Thanks for any help.
for(var touch:iPhoneTouch in iPhoneInput.touches)
{
m_touchPosition.x = touch.position.x;
m_touchPosition.y = touch.position.y;
m_ray = m_camera.ScreenPointToRay (m_touchPosition);
Debug.DrawLine (m_ray.origin, m_ray.GetPoint(20));
var hits : RaycastHit[];
hits = Physics.RaycastAll (m_ray, 20.0);
for (var i=0;i<hits.length;i++)
{
var hit : RaycastHit = hits[i];
Debug.Log(i + " " + hit.transform.tag+" :"+m_state);
}