- Home /
Smoothing eulerAngles rotation?
So i have a character selection rig set up and i am using
transform.rotation.eulerAngles = Vector3(0, 0, 0);
to change the rotation so you can select different players.
My question to the community is how do i smooth out the rotation over timer instead of instant rotation to object position.
Here is what is in the Update.
if(RotateNum == 0){
transform.rotation.eulerAngles = Vector3(0, 0, 0);
}else if(RotateNum == 1){
transform.rotation.eulerAngles = Vector3(0, 90, 0);
}else if(RotateNum == 2){
transform.rotation.eulerAngles = Vector3(0, 180, 0);
}else if(RotateNum == 3){
transform.rotation.eulerAngles = Vector3(0, 270, 0);
}
Answer by Benproductions1 · Sep 10, 2013 at 11:29 PM
Hello,
To create smoothing effects you need to move over a period of time. One way of doing this is using Lerp
, which is a static
Vector3
method.
However, using eulerAngles
for interpolation is not the best idea, due to many of the downsides of Euler Angles, I would suggest using the already built in Quaternions. Using these avoids gimbal locking as well as solves the shortest rotation problem. Therefore I sould suggest using Quaternion.Lerp
and Quaternion
rotations instead of EulerAngles
Hope this helps,
Benproductions1
I ended up using the the Quaternion.Lerp to $$anonymous$$ipulate a the Smoothing of the rotation. Thanks for the help!
Your answer
Follow this Question
Related Questions
Rotation Jumping values (0 to 180) 1 Answer
When applying a 90 degree rotation to Euler Angles, it is over/undershooting sometimes.. 2 Answers
How to rotate an object around another 60 degrees with a keypress? 0 Answers
Proper way to rotate an object? 1 Answer
How to properly reference a Euler? 1 Answer