touch.deltaPosition different on different devices

I am using the Input.touches plugin to drag a game object horizontally across the screen. This, after some conditions is called in the OnDragging event:

   posX += (dragSpeed *;

posX is then added to a vector3 and set as the new position of the game object. dragSpeed is set with a constant.

My problem is that while it works fine for the device I developed on, when tested in other devices it is faster or slower.

I understand that the screen dpi or resolution plays a part, but I can’t get a formula to correct it that works across all devices. I had a solution that worked between the android tab2, ipad4 and the ipod touch, but when I tried it on the ipad mini it was significantly faster.

I was taking the change in screen width and dpi from a bench mark dpi and screen width and increasing or decreasing the dragSpeed.

The only thing I can think of is that the frame rate is affecting it, but then I can’t understand why my solution would work between an old iPod touch and an ipad4, but not the mini.

Well I don’t exactly understand the question, but I think one fundamental question is do you want the object to be pushed by how fast your finger slides, or do you want the object to imitate your finger’s position on-screen? I found through multiple tests that the latter feels much more intuitive and natural, but there are reasons to do both.

If you’re doing the latter, one thing you could consider is normalizing the input, meaning put it on a scale from 0-1. So where ever you plugged in the input in your code, replace that with a variable that’s equal to the x input divided by screen.width and the y divided by screen.height. There probably be an easier
to do this, but I can’t think of it at the moment

Edit: Actually I just remembered one way. If you don’t need multitouch, since unity automatically makes touch input emulate mouse input by default, you can use Camera.ScreenToViewportPoint(Input.mousePosition) instead. It’s pretty accurate, and it’s already normalized! I would try this to see if its the same across devices

That’s all I got really. You posted very little code, which is crucial with this type of question, so I hope that helped

In the end I managed to get a consistent delta position, by first converting the mouse input to world values:


then I created my own deltaPosition with that and used that instead of the touch deltaPosition

Probably not the best method to make it consistent, but it worked.