Discussions

Ask a Question
Back to All

Strange Gimbal Locking issues with Touch Controllers

I'm getting odd behaviour from the Touch Controllers localRoation values. They seems be flipping from positive to negative polarity depending on the controllers rotating past particular 90 or 180 degree angles on various axis.

I know this is Gimbal locking related yet on the Vive it's no issue. Do you know a solution? I fear it's too much for my mind to grasp.

Hi me again, ok so it's 2 days on this issue and I'm just starting to grasp the reason for the problem yet I'm struggling with the solution due to Quaternions being so complex.

Let me explain my use case. Picture a helicopter with the Player moving in the helicopter, the user controls the pitch/roll/yaw using tilt with the 3 axis of the right controller. This why I must use localRotation.

Issue. Depending on where the player points the controllers when the level starts/spawns will determine the signs of the values returned by transform.localRotation. e.g Point the controller towards your right on level start, localRotation.y value when twisting right will move in the positive direction. Now point the controller towards your left on level start, localRotation.y value when twisting right will move in the negative direction.

helicopter.VRInputYaw (transform.localRotation.y * yawTwistAmount);

Now when I use the Vive Controllers this is never a problem. I'd be very grateful if you know the solution to this and could help? Thanks