I'm having an odd issue at the moment with Screen to World Point...
I'm using a sphere as a cursor, it's parented under the Main Camera in scene, if I attach the following script it follows the mouse perfectly no matter what the rotation of the camera is:
function Update () {
var screenPoint : Vector3 = Input.mousePosition;
screenPoint.z = distanceFromCamera; //distance of the plane from the camera
transform.position = Camera.main.ScreenToWorldPoint(screenPoint);
}
If I set up an FSM using Get Mouse x/y, passing them to Screen To World Point and then setting the x/y position of the sphere, it works fine if the camera is 0,0,0 but drifts away from the cursor if I rotate it at all?
I've got the scene working by using a combination of the above script and various FSMs but I'm just curious what the discrepancy might be? Anybody else using Screen To World Point in a similar manner and getting better results? Am I missing something obvious?
Thanks for your time,
Nick