Jump to content
  • Advertisement
Sign in to follow this  
DarkMatter2008

2D Camera smoothing

This topic is 3799 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

Hi All, I want a camera to be able to follow a character on a 2D character, the problem is the character's movement is going to be very jagged and unpredicible, so I need the camera translation to be smoothed out. How can I do this? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Easy way; each frame, take where you want the camera to be and where the camera currently is, and place the camera at their average.

More explicitly; you can use any blending factor, not 0.5, if you want. Use a higher factor (<= 1) for closer and tighter response, use a lower factor for slower and smoother follow.
vActual = vDesired*factor + vActual*(1.0 - factor);

Does that work well enough?

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!