Hi guys, I’ve got a problem with the following code.
What I’m trying to do is get the players finger position on a touch screen (done and working), then convert that Vector2 to a Vector3, so I can use it in ScreenToWorldPoint. I then use this new vector3 to set an objects position in the world. The issue is, once I’ve converted the screen coordinates to world coordinates, the world coordinates only seem to move between -0.1 to +0.1 on the x axis and similar on the Y when I move my finger.
BTW the Vector2ToVector3 just adds a 0.0f to the z component and returns a vector3.
private void PositionObjectByFinger ()
{
// Convert fingerPosition from a Vector2 to Vector3 as thats what ScreenToWorldPoint requires
worldFingerPosition = Utilities.Vector2ToVector3 (Input.GetTouch (0).position; );
// Convert finger position from screen to world co-ordinates
worldFingerPosition = referenceToCamera.ScreenToWorldPoint (new Vector3 (worldFingerPosition.x, worldFingerPosition.y, referenceToCamera.nearClipPlane));
}
Thanks for any insight!
Cheers