GetTouch Coordinates Usage

I’m sure this is simple. Somehow I completed my first game without needing to know this.

I am trying to learn how to use GetTouch etc rather than the mouse/button input. Crazy how something so seemingly rudimentary is such a pain to learn for me.

So I have this code:

if (iPhoneInput.touchCount >0){
		pos1 = iPhoneInput.GetTouch(0).position
	}

How do I use this so I can detect if a touch was made in a specific area of the screen? Say between x locations 100 and 200.

In other words, how can I parse the variable pos1 to get the x and the y as an integer? I’m not interested in touching objects or GUI elements, just screen coordinates.

Thanks! :sweat_smile:

how about pos.x, pos.y? :slight_smile:

Thank you! I was trying pos1.position.x

Oh well :sweat_smile:

no prob :slight_smile:

normally you potentially would need it, if you just returned a transform / touch. but you explicitely requested the position (a VectorX with X 2 or 3 depending on what you get the position of, ui / screen or transform / ray etc)