aspose file tools*
The moose likes Game Development and the fly likes Interpolation using Object's old and current positions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Interpolation using Object Watch "Interpolation using Object New topic
Author

Interpolation using Object's old and current positions

Stephen Bell
Ranch Hand

Joined: May 11, 2013
Posts: 38
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!


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Interpolation using Object's old and current positions