Interpolation?

Official forum for the Chipmunk2D Physics Library.
Post Reply
CapnPolo
Posts: 3
Joined: Tue Dec 09, 2008 5:28 am
Contact:

Interpolation?

Post by CapnPolo »

Reading through these forums I've seen http://gafferongames.wordpress.com/game ... -timestep/ linked to and the approach in the article seems an excellent suggestion.

I'd like to implement that approach but one thing that is not clear to me is how to go about interpolating with Chipmunk (described in the article under "The final touch").

Does anyone have any suggestion on how to go about implementing interpolation like this to remove any stutter?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Interpolation?

Post by slembcke »

Ah, yes. I've been meaning to implement the very same thing in one of my games actually.

I was going to do it by remembering the current and previous position/rotation and interpolating that. It means that you will always be rendering as much as frame behind, but who is going to notice < 1/60th of a second delay? The other option is to use the velocity to guess where the object was. This will be off by a little bit when collisions happen, though it would be off by less than it would be without interpolation.

I've actually never really noticed any problems arising from using a 1/60th second time step and using vsync. Admittedly, I've been using DVI displays for a while now which all run at 60hz anyway.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
CapnPolo
Posts: 3
Joined: Tue Dec 09, 2008 5:28 am
Contact:

Re: Interpolation?

Post by CapnPolo »

My intention is to use it on the iPhone where I'd like a drop in framerate to be acceptable without slowing the physic simulation.

Currently I'm just modifying the Chipmunk demo's to try it out.

So would you keep a copy of space->activeShapes and space->staticShapes for both current a previous and then build a list of interpolated positions/rotations?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest