Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interpolation using Object's old and current positions

 
Stephen Bell
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I'm attempting to smooth out the animation of my sprites using interpolation and am have a lot of problems.

I've managed to get some success using this method of applying the interpolation during my render call:



When the sprite is moving, it is almost perfectly smooth (it's like a 95% improvement on no interpolation) but when the sprite is static, the interpolation is still applied and the sprite therefore has a 'wobbling' effect. (It also play havoc with my collision detection but that's for another day!)

Now, I've come across another method, which seems more sensible. This method necessitates us saving the sprites previous position so the following calculation can be made in the render call:


Now, this doesn't wobble when the sprite is static, because the difference between the current and old positions would be 0. However, when the sprite moves, there is no improvement in the choppiness. It also seems to behave better with regards to collision (but this is probably because it's not actually interpolating correctly!)

Oh, and this is my game loop showing how I work out my interpolation value:



I would be very grateful if somone could tell me why the 2nd method doesn't seem to be doing anything.... is the calculation wrong? How do I go about interpolating between an object's previous and current positions?!

Thanks all!


 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic