Jump to content
  • Advertisement
Sign in to follow this  
CadetUmfer

Lerp 2D Rotation

This topic is 3615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm smoothing out a networked game object with interpolation. I can't simply use linear interpolation on the rotation, since it's clamped [0..2pi], so interpolating from say 5.x to 0.x just makes dub-step dancing objects :D So, is there a quaternion slerp for floats, or what should I do here?

Share this post


Link to post
Share on other sites
Advertisement
Did this the hackish way.
if (angleTo > angle)
{
while (angleTo - angle > MathHelper.Pi)
{
angleTo -= MathHelper.TwoPi;
}
}
else
{
while (angleTo - angle < -MathHelper.Pi)
{
angleTo += MathHelper.TwoPi;
}
}
angle = MathHelper.Lerp(angle, angleTo, alpha);





If there's a better way lemme know. Happy Thanksgiving!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!