Occasional Wrong Turn even on the phone

When I’m playing on my android phone, I have the same bug as in the Device Simulator. If I keep tapping the same spot on my screen to turn, my car will occasionally turn the wrong direction.

Unity Version is 2020.3.18f1

Sorry, I must have missed this question earlier.

I’ve found the best fix for this is to not use buttons for the cars, but to instead query the touch screen system directly:

 void Update()
    {
            if (Touchscreen.current.primaryTouch.press.isPressed)
            {
                Vector2 touchPosition = Touchscreen.current.primaryTouch.position.ReadValue();

                Steer((int)Mathf.Sign(touchPosition.x - (Screen.width/2.0f)));
            }
        currentSpeedMultiplier += gainOverTime * Time.deltaTime/100f;
        transform.Rotate(0,steerValue * turnSpeed * Time.deltaTime, 0);
        transform.Translate(Vector3.forward * speed * currentSpeedMultiplier * Time.deltaTime);
    }

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms