problems interpolating frames

compound

20-02-2008 21:56:06

ok basically i have read countless amounts of threads that seemed related to this and tried pretty much everything i could to fix it

originally i was using an ogrenewt basic frame listener at 60 fps, without vsync on this messed up the whole simulation.

with vsync on it seemed to move in time, but every now and then (as ive discovered now through reading the code) that it has a hack to make it "catch up" i think this is the point i have the problem, moving bodys such as my lifts and player character seem to shake about very badly until it has caught up with the current frame time., is usually for less than a second but is still VERY noticable.

now ive tried various different modifications to the ogrenewt basic frame lsitener that i have seen around the forums with little success

the only thing i have found that has worked reasonably well is update the frame like this m_World->update(60); in my main frame listener. the bodys move as expected no jittering or collision issues.

but for some reason using this method makes the motion seem to be "low gravity" .

does anyone know how i can solve this problem?

thanks alot

compound

21-02-2008 12:14:22

ive found that calling world update twice in a frame causes the gravity to look as it should. but completely messes up my movement on slopes

albino

21-02-2008 12:22:33

whats your scaling of objects,
i had slow motion problem once

solution was a mistake in code, i scaled items
something like 50m x 50m x 1m box was scaled to
500m x 500m x 10m so falling down 500 m takes longer
than falling down 50 m, so you have to adjust the gravity or
scale items down and see if that works

compound

21-02-2008 12:34:44

well im using the ogre ninja but i scaled it down really small (cant remember exact value was a while ago) as i had problems with my directx engine and newton, scaling a while back.

the dimension for my ninjas capsule is radius 1 and height 3.8

i know these arent exact person size dimensions but i think they are close enough to be fairly accurate

edit: adjusting the gravity enough to make it believable makes my character sink through objects also

compound

21-02-2008 15:09:09

with "magic numbers" for gravity it seems that it is only the edges of things my charatcer sinks into, if standing right on the centre of mass of a platform it doesnt seem to sink in (or at least not as much), some meshes it sinks into when it lands at a hgh velocity, sometimes its feet will go completely under, but platforms 1-5 m high and 15m wide the character will sink through significantly more the closer to the edge it is, to the point of falling through

at first i thought it was my values for inetia but im now using the ogrenewt functions to do this

Ogre::Vector3 inertia;
Ogre::Vector3 offset;

col->calculateInertialMatrix(inertia,offset);

compound

21-02-2008 23:47:24

after a bit more messing around with the inertia it seems to work ok now, my gravity is set to 3 X 9.8 but it hink this is ok due to my scaling, but no sinking of objects and the frames keep in time :)

albino

22-02-2008 08:26:13

nice to hear that

the sinking to objects may cause because of
high velocity = last update happens just before object collides
and next update the body is already inside of it so it
looks like it sinks, so avoid small objects/extremely high velocities

damiensturdy

22-02-2008 09:23:11

Huh... This workaround links the physics logic to the FPS, does it not?

Are people seriously saying the way to stop the twitching it to lock the time step and update at the same rate as the FPS?

I had feared this, and suspected it from day one, but how is it that stunt playground 2 works?

compound

22-02-2008 09:56:15

one possible other way to solve this which will probably be alot smoother.

cache every newton matrix for set number of frames..... then instead of using the accumilator "catch up" method, could use this cache of matrices to smooth the "catch up" so it always appears to be fine.

this is beyond the scope of my project for now but id imagine it is a nice elegant solution