Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Touch Input positions are different on iOS and Android?

$
0
0
I'm using touch input to drag the camera around on the x-y plane. For some reason, the camera's movement is much slower on Android than it is on iOS. I get similar results on iPhone, iPad, and the Unity Editor, but the panning is slow on Android. I'm simply using pixel measurements and dividing by the screen height, so screen size should not matter (and does not matter on iOS). I'm using Easy Touch for input. gesture.deltaPosition is a Vector2 in pixels that stores the change in position since the last frame. On_TouchDown is called every frame that the player is touching the screen. Here's the code: void On_TouchDown(Gesture gesture) { if (gesture.deltaPosition.magnitude > 0) { Vector2 deltaPosition = -1f * panSpeed * (gesture.deltaPosition / (float)Screen.height); transform.position = new Vector3( transform.position.x + deltaPosition.x, transform.position.y + deltaPosition.y, transform.position.z); } }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>