- Home /
Question by
homer_3 · May 28, 2017 at 06:34 PM ·
quaternionmathvector
How to get up vector of rotation?
If I have an object that is looking forward (forward vector is (0, 0, 1)) and its up vector is (0, 1, 0) and I rotate it to face down, its forward vector would change to (0, -1, 0) and its up vector would change to (0, 0, 1).
To create this rotation, I could do Quaternion.LookRotation(new Vector3(0, -1, 0)). If I know the starting up vector, is there some way I can use this rotation to get the resulting up vector?
Comment
Best Answer
Answer by villevli · May 28, 2017 at 06:47 PM
You can rotate a Vector3 by a quaternion by multiplying them Quaternion.operator*
Vector3 resultingVector = rotation * vector;
Vector3 resultingUpVector = rotation * Vector3.up;