Rotate and Scale using touch fingers in Unity

Viewed 24

I'm trying to Rotate an object using one finger and if I use two fingers I must scale the object but I can't develop a solution for this requirement. I saw some tutorials to use Assets like Lean Touch or Input Gestures but I can't find the required scripts in the free assets. I tried the code below but the touch screen took the input from the mouse (OnMOuseDrag).

public class rotateObject : MonoBehaviour
{
    float rotSpeed = 20f;

    private void OnMouseDrag()
    {
        float rotX = Input.GetAxis("Mouse X") *rotSpeed*Mathf.Deg2Rad;
       // float rotY = Input.GetAxis("Mouse Y") * rotSpeed * Mathf.Deg2Rad;

        transform.RotateAround(Vector3.up, -rotX);
        //transform.RotateAround(Vector3.right, rotY);

    }
}
0 Answers
Related