- Home /
Question by
darker9999 · Feb 03, 2014 at 12:28 PM ·
rotationquaternionrotate objectlookrotation
How To Prevent Axis Fliping When Rotating
Hi,
I am trying to rotate objects in the game by using Quaternion.LookRotation and when rotating around the x-axis (using a planecast and and ensuring that it means rotation only occurs on one axis) it sometimes flips the direction of transform.right.
Vector3 lookPos = hitPoint - tempParent.transform.position;
Quaternion rotation = Quaternion.LookRotation(lookPos, tempParent.transform.up);
tempParent.transform.rotation = Quaternion.Slerp(tempParent.transform.rotation, rotation, 1f);
Comment