understanding the coordinate system of Input.GetTouch

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

This is definitely not normal behaviour- GetTouch returns screen-space coordinates, which should be 0,0 at the bottom left and Screen.width, Screen.height at the top right.

Are you using Unity 4.5 or earlier? Which platform? Is this is a build or using Unity Remote?

First blush I’d say upgrade Unity. There was a problem like this back in pre-4.6p1 releases that involve the orientation of the device being changed and the coordinate system turning wonky as a result.

Thanks for answering Lysander,

this is Unity 5.1.1
unity remote 4
iphone 6 with iOS 8.4
and its on a mac running Yosemite.

found demo project online where someone was trying to do something similar (spawn particle system at touch locations) and I get a perhaps similar/related bug where the visual orientation and the touch event orientation seem to get out of wack. So it will visually look landscape but the click events seem as if its squishing the touch coordinate system like perhaps the touch coordinate system is set to vertical or something.

Here is the link to the project info and you can grab the project on github:

thanks

I don’t have a device with iOS, only Android, so even if I could download and get it working properly, that may not help you. That said, I’m a bit curious, so I’ll give it a shot and see if maybe it’s a programming problem.

The code that you posted isn’t translating the screen space coordinates into world coordinates using Camera.main.ScreenToWorldPoint() before instantiating the effect, but you have a “worldPosition” vector, so I’m assuming you maybe oversimplified it for posting on the forum? That would not explain the print method getting negative numbers from the screen space position, so I didn’t mention it.