Im getting strange results from a simple script. Im trying print to the console the coordinates where the touch event happens.
While I am successfully printing the coordinates, I dont understand the coordinate system unity must be using to create them. For example, my top left click is around (-507.2, 452.6, 0.0), top right is (389.2, 487.7, 0.0), bottom right is (373.2, 62.2, 0.0) and bottom left is (-478.5, 35.1, 0.0)
It seems like seems like the coordinate system is somewhere ~900 wide by ~420 tall. It also seems like the coordinate system is not centered as if I click on around the center of the screen I get coordinates like (-22.3, 291.7, 0.0)
Other info about this project includes:
• camera set to 0,0,-1000
• there is an object set to 0,0,0 which looks like its in the center of my screen
So the questions I have are:
• what is the total size of the coordinate system being used?
• Where is the zero zero point of the coordinate system?
• Does the coordinate system change if the device changes?
here is the script
using UnityEngine;
using System.Collections;
public class getTouchPosition : MonoBehaviour {
public Vector3 fingerPos;
public Vector3 worldPosition;
public GameObject[] particleList;
// Update is called once per frame
void Update ()
{
if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began)
{
fingerPos = Input.GetTouch(0).position;
print (fingerPos);
actionFromTouch();
}
}
void actionFromTouch(){
GameObject thing = Instantiate (particleList [0], fingerPos, Quaternion.identity) as GameObject;
}
}
thanks