- Home /
Question by
vinicius47 · Jun 08, 2014 at 06:01 PM ·
rotationquaternionmatrixrollangleaxis
Change the roll of the rotation
I have a code to change the pitch and yaw of the rotation reference to an direction, but when i try to roll the object arround the local up axis, thing get pretty messed up. Here is my code:
forward = GetGForce();
relativeAngleX = Quaternion.AngleAxis(x, Vector3.Cross(forward,Vector3.up).normalized);
relativeAngleY = Quaternion.AngleAxis(y, forward);
relativeAngleZ = Quaternion.AngleAxis(z, transform.up);
transform.rotation = relativeAngleZ * relativeAngleY * relativeAngleX * Quaternion.LookRotation(forward);
I already try to change the order of the matrix multiplication, but i got the same results.
Comment
Your answer
Follow this Question
Related Questions
Finding roll angle 0 Answers
How to Decompose a TRS Matrix? 3 Answers
Quaternion to Matrix Conversion Error - Camera Script 0 Answers
Matrices to rotation 1 Answer