Amplify Gyro Input

So I’m getting a quaternion back from a gyroscope in my mobile device, and I’m using that to rotate an object in my game. What I’m trying to do is amplify the amount of rotation by some amount, so if the gyro is rotated 90 degrees clockwise, the object in game will actually rotate more like 120 degrees clockwise. Is there a recommended way to do this? Quaternion math is sort of a black box to me.


It’s a terrible idea. Just don’t do it. They can blow up in so many ways. As soon as you are doing rotation on more than 1 axis, Quaternions all the way.

There are tons of way to do this. If you simply want to double the rotation (moving 1 degree IRL moves 2 degree in game), just do:

transform.localRotation = initRotation * rotateFromGyro * rotateFromGyro;

if you actually want a factor, just do

transform.localRotation = initRotation * Quaternion.LerpUnclamped(Quaternion.identity, rotateFromGyro, ratio);

If the ratio is 0.5f, you’ll get half the rotation, if it is 2f, you’ll get twice the rotation. There might be unforeseen behaviors, but this should work.