Rotating an object smoothly, towards user inputted Vector3
So in my current project i have a function which is supposed to be used trough a keypad. Said Keypad stores 3 input values as X,Y,Z. Pressing OK after all the values have been typed in, i want an object which is my cockpit, to rotate towards the given coordinates smoothly. I tried with Quaternion Slerp where im having problems determining what the W value should be for my new rotation, so i get false rotations. I dumped that idea and I'm trying to figure out a way to make it work properly, but pretty much I'm stuck. Some help or ideas would be welcome. Thanks in advance tomdancer.
Answer by SmomoGame · Oct 19, 2016 at 08:18 AM
Try use Quaternion.LookRotation() to generate a Quaternion correctly instead of assigning a literal Quaternion, because the "w" value always confused.
If you want a "Right" Quaternion relative to player, Quaternion.LookRotation(transform.right) will work well.