Hello,
I am completely need to unity and I am trying to get the coordinates of a mouse click in world space. To do this I am trying to shoot a ray down and return where it hits the game object under the mouse click. The problem I am having is that the ray hits no where close to where I click my mouse.
This is the code I am using, taken straight from examples on the internet.
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit:RaycastHit;
Debug.DrawRay(ray.origin, hit.point, Color.red);
So, for example, if I click somewhere near point (5,-13,32) the ray hits at (98,1,50).