Why is the Iphone Touch position inverted ?

	void OnGUI()
	{
		foreach(Touch touch in Input.touches)
			GUI.Label(new Rect(touch.position.x, touch.position.y, 100.0f, 100.0f), "Touch");
	}

I’m having trouble with the touch input from the Iphone/Ipad. I’m using this simple code just to test the touch input ^^ and draw a label where ever you touch on the screen. For some reason the y position is inverted. Whenever you move upwards the label moves downwards, and visa versa.

I thought it had something to do with the position maybe being in screen space, so I tried converting it using GUIUtility.ScreenToGUIPoint, but still no joy.

Any help would be much appreciated, thanks!

Mike.

Touch.position is screen space and OnGUI functions use GUI space. You can always do “Screen.height - touch.position.y” to get GUI coords.

–Eric

Thanks man, I’ll give it a try

Mike.

Why does GUIUtility.ScreenToGUIPoint() not do this for you?
as if that is what you need to do? I assume that it has something to do with touches being slightly different to other screen points (e.g. mouse) in some way that would make that Utility function too specific?
Maybe there should be a GUIUtility.TouchToGUIPoint()?