- Home /
Question by
embeddeddreams · Sep 17, 2018 at 07:37 AM ·
touch controlsmobile devicesmotionscreen resolution
How can I handle touch control problems due to screen resolution of different mobile devices?
I use swipe behaviour for player movement and want to set a treshold for undesired movement due to finger's small vibrations.
But in different devices, it is not work properly. In some devices finger vibrations effect motion, but in other some devices can not capture motion. I think swipe vector is changed because of screen resolution.
A piece of movement code is that;
if (touch.phase == TouchPhase.Moved)
{
swipeDelta = Input.touches[0].position - lastTouchPosition;
if (swipeDelta.x < 0 && Mathf.Abs(swipeDelta.x) >= 0.3f)
{
if (rb.position.x == 0 || rb.position.x == 2)
goLeft = true;
}
}
I have replaced
Mathf.Abs(swipeDelta.x) >= 0.3f
with
swipeDelta.magnitude > 30
But same problem is continued.
Comment
Your answer
Follow this Question
Related Questions
CrossplatformInput not detecting MultiTouch on Android build 1 Answer
If I use Input.GetMouseButtonDown does it translate to touch? 1 Answer
Grabbing objects for touch controls? how 2 Answers
Mobile Joystick doesn't work when Mouse Cursor is locked 0 Answers
KeyboardOrbit with DualTouchControls 1 Answer