Search code examples
unity-game-enginetouch

Rotate using Lean Touch and 1 finger


How can you rotate a model using Lean Touch in Unity, and only 1 finger? The default appears to be 2.

I tried setting the Required Finger Count to 1, but then nothing happens.

Any ideas?


Solution

  • I ran into the same issue. Unfortunately, i couldn't figure it out.

    Instead I attached the following code to my GameObject. When moving your finger from left to right, the GameObject the script is attached to rotates accordingly around its Z-axis.

    void OnMouseDrag()
    {
        float rotationX = Input.GetAxis("Mouse X") * rotationSpeed * Mathf.Deg2Rad;
        transform.Rotate(Vector3.down, -rotationX, Space.World);
    }