Can anyone explain what Touch.position actualy returns?

Hi all i’ve been trying to implement two finger pan and zoom however to do it right i need to translate touch to world view

the problem is i was expecting touch.position to return a Vector2 with values between 0 and 1 representing the viewport instead i’ve found its returning values in these sort of ranges.

Vector2(0 ↔ 864.6 , 0 ↔ 433.3)

what are these values? they dont seem to change when the cam moves so they must be screen related there not pixels as the iphone doesn’t have that many pixels.

the unity iphone documentation says nothing about what the return values are just that there the position of the touch.

if anyone knows what they represent or at the least what there exact ranges are so i can scale them to (0 ↔ 1) it would be very helpful.

Thanks in advance Rob.

Its in pixels. I think you can get an incorrect range on the device if you haven’t set your viewport in unity to be an iphone resolution - you can choose iPhone wide or iPhone tall from a pull down menu at the top of your game viewport.

Where exactly are you finding that choice? I just see X and Y at 0 under Normalized View Port Rect?

Referring to this… pretty sure if you don’t select iPhone Wide or Tall you’ll get weirdness on the device.

202697--7488--$wide_105.jpg

Ah, thank you. I didn’t even see that.

Is there someway to change that in your scripts for when you rotate the device?

thanks for the help this has been bugging me all day.

I’ll try setting the view port size in my unity window when i get in tomorrow.