Question by
youshaa_murhij · Feb 17, 2019 at 06:33 PM ·
rotationquaternioneuleranglesjoints
Rotation Problem on X Axis over 90 and -90 degrees!
I am using this code below to rotate a joint around x axis from -120 to 120 degrees and everything is working fine from -90 to 90 degrees but if the rotation angle is over 90 or under -90 the joint starts an infinite rotation ...maybe I should change the other axis rotation values ,too ?! I am using this way on Z and Y axis and everything is good.
if (transform.localEulerAngles.x > 180)
{
ACT = transform.localEulerAngles.x - 360;
}
else
{
ACT = transform.localEulerAngles.x;
}
d_theta2 = theta_2 - ACT;
Quaternion originalRot = transform.rotation;
transform.rotation = originalRot * Quaternion.AngleAxis((float)d_theta2, Vector3.left);
Comment
Your answer
Follow this Question
Related Questions
Help with suns rotation 0 Answers
Quaternion.Euler doesn't work right? 2 Answers
Rotation problem 0 Answers
Quaternion.LookRotation on only one axis? 1 Answer
Rotate clockwise/counterclockwise using Quaternion.Slerp() 0 Answers