- Home /
how do i take gyro rotation and multiply it?
All i need is gyro input in, multiply by modifier then move camera by the result. Surely this must be possible although i can't find a single example of it. Should be really really simple but i just can't make it work ( also eulers don't work as gimbal lock breaks them)
i.e. so if i move the phone 45 degrees the camera moves 90 degrees.
Answer by Remy_Unity · Jul 12, 2018 at 07:29 AM
Since the gyro value is a quaterion rotation, you could use Quaternion.LerpUnclamped : https://docs.unity3d.com/ScriptReference/Quaternion.LerpUnclamped.html
Quaternion finalRotation = Quaternion.LerpUnclamped( Quaternion.Identity, Input.gyro.attitude, multiplier );
This will effectively lerp from no rotation (Quaternion.identity) to the gyro rotation, but in and unclamped way, so value > 1 will "multiply" the gyro rotation.
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
how to clamp y axis with Quaternion.Euler in unity 1 Answer
Trouble with Camera Rotation Math 2 Answers
How do I stop my camera flying? 0 Answers
issue after 360 degrees rotation 1 Answer