I have a curious problem with Physics.Raycast(ray, out hit).
I have my ARCamera set to center World Center NONE and 3 Markers. These 3 markers are tracked perfectly.
When I touch one these markers following code is issued:
ray = Camera.main.ScreenPointToRay(Input.touches[0].position);
//Also tried this, but did not work:
if(Physics.Raycast(ray, out hit, Mathf.Infinity))
if(Physics.Raycast(ray, out hit))
{
string colliderName = hit.collider.name;
Debug.Log("My Marker is " + colliderName)
}
Unfortunately when I take some distance (let's say 1,5 m) from the markers or quickly move, the collider name is incorrect taking the name of another marker but not from the one touched. With a distance of 30cm to 1m everything is working perfectly.
Is there something I need to set up in the ARCamera settings to avoid such problem with Physic.Raycast? Is this due to the World Center NONE (I've also tested it with World Center USER, but faced the same problem)?
Thanks a lot!
I've filed this as a future improvement, thanks!
- Kim