JV-ODE Physics Thread 5

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 5

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@Avon: You're welcome and thanks :)

@Shifty: Wayne is correct. The problem is the speed of the collision compared to the length of time QuickStep passes. Speeding up the simulation by raising the step time will cause ODE to start skipping the contacts, regardless of the QuickStepNumIterations value. It has to do this to keep the simulation stepping in sync with real time. Also, setting the max contacts to '1' with 'dContactSetMaxContacts(1)' will help stop some of the penetration but not much.

So, what's the solution? How do we speed up a simulation and still maintain the accuracy? The answer is to perform the 'complete' step process multiple times, so that it doesn't miss any contacts.

For example, to speed the example up by 100%, you should call the QuickStep twice in the main loop...

dSpaceCollide(Space,World,ContactGroup)
dWorldQuickStep(World,0.1)
dJointGroupEmpty(ContactGroup)

dSpaceCollide(Space,World,ContactGroup)
dWorldQuickStep(World,0.1)
dJointGroupEmpty(ContactGroup)


...and voila, it's twice as fast without penetration.

If your simulation ever gets penetration, lower the QuickStep value until it's no longer penetrating. Then start adding multiple QuickSteps with the same stable value to speed up the simulation.

:)