cancel
Showing results for 
Search instead for 
Did you mean: 

Trackpad and rotation

Anonymous
Not applicable
Hello, I have a problem with using trackpad's x axis to rotate an object about it's y axis. Swiping the trackpad back and forth works great, the object rotates as it should. But each time I release the trackapad (ie. once I reach eaither of it's ends) and press again to rotate further, the object's y angle jumps to some strange angle.

It works as it should in the editor, but not on GearVR. I am probably missing something simple. Thanks in advance!

I'm using Unity 5.4.0f3 and Utilities 1.5.0

Here is the sample code:

GameObject myObject;
Vector3 objRotation = new Vector3(0f, 0f, 0f);
float objRotateSpeed = 60f;
...
void Update()
{
    float mouseX = Input.GetAxis("Mouse X");            

    if(mouseX != 0f)
    {
        objRotation.y += mouseX * Time.deltaTime * objRotateSpeed;
        myObject.transform.rotation = Quaternion.Euler(objRotation);
    }
}
1 REPLY 1

Anonymous
Not applicable
I ended up doing this by using OVRTouchpad. Everything works as it should now 🙂