Touch.position is incorrectly offset
Hey guy.
I want to get a collider by shooting a ray from my camera through a Touch.position.
Im doing this by:
Ray ray = Camera.main.ScreenPointToRay (someTouch.position);
Seems correct? Well it doesnt return the correct ray though. This is either a problem with the Touch.position property being off or the ScreenPointToRay Function not working correctly.
I should mention that sometimes (especially when I move my finger) both rays get displayed. The wrong one and the correct one. That lookes like this:
Only the wrong one registers colliders though.... so thats a problem.
Some additional information:
Camera is ortographic, stationary and rotated.
I havent tested if the problem still occures when I build the game. At his point Im using Unity Remote to test my game.
Anyone got an answer to this? :)
EDIT:
I found that the problem lies in that my game and the phone I used for remote had different resolutions. The offset the rays have change when I change my game resolution. I have not found the correct res yet.
EDIT EDIT:
It seems that Touch.position depends on how big your gameview window is... so... thats weird... Anybody knows how to actually get the Touch.position of the actual screen?