I am having the same problem. I am using Unity iPhone.
Debug shows that the mouse input is changing, and the viewport point is changing, but not the world point.
var input : Vector3 = Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 0);
var testViewportPoint : Vector3 = Camera.current.ScreenToViewportPoint(input);
var testWorldPoint : Vector3 = Camera.current.ViewportToWorldPoint(testViewportPoint);
testWorldPoint.z = 0.0;
Debug.DrawLine(objectToMove.transform.position,testWorldPoint);
var layerMask : int = ~(1 << 8);
var hit : RaycastHit;
if (!Physics.Linecast(objectToMove.transform.position,testWorldPoint,hit,layerMask))
{
Debug.Log(layerMask + " (" + objectToMove.transform.position + ") (" + input + ") (" + testViewportPoint + ") (" + testWorldPoint + ")");
objectToMove.position = testWorldPoint;
}
else
{
Debug.Log(layerMask + " (" + objectToMove.transform.position + ") (" + input + ") (" + testViewportPoint + ") (" + testWorldPoint + ") "+ hit.collider.gameObject.name);
}
Sample Debug:
-257 ((-191.5, -285.6, 0.0)) ((2.0, 2.0, 0.0)) ((0.0, 0.0, 0.0)) ((-191.5, -285.6, 0.0))
-257 ((-191.5, -285.6, 0.0)) ((150.0, 249.0, 0.0)) ((0.5, 0.5, 0.0)) ((-191.5, -285.6, 0.0))
-257 ((-191.5, -285.6, 0.0)) ((322.0, 458.0, 0.0)) ((1.0, 1.0, 0.0)) ((-191.5, -285.6, 0.0))
Anyone else having this problem?
ScreenPointToRay seems to work okay.