I have proper frame independent simulation, with proper world scale (1 unit = 1 meter), but the collision is inaccurate.
Slow moving objects are unsteady on first inpact (even with just falling boxes affected only by gravity).
Bit faster objects even miss colllision altogether, and escape geometry (like boxes shot with applyCentralImpulse function with impulse 40 in a forward direction).
Simptons are demonstrated here:
https://youtu.be/BdHnKF5gl_A
I use bullet-2.81-rev2613 version.
Based on documentation: http://bulletphysics.org/mediawiki-1.5. ... D.3D_1_.3F
, I just need to increase the resolution, by passing higher maxSubstep and lower fixedTimeStep parameters,
so instead of this:
Code: Select all
stepSimulation
(
static_cast<btScalar>(frameTimer.getElapsedSeconds()), //btScalar timeStep: frameTimer.getElapsedSeconds() returns sensible seconds frame by frame like 0.0164509
1, //int maxSubSteps,
btScalar(1.)/btScalar(60.) //btScalar fixedTimeStep
);
Code: Select all
stepSimulation
(
static_cast<btScalar>(frameTimer.getElapsedSeconds()) //btScalar timeStep,
10 //int maxSubSteps,
btScalar(1.)/btScalar(240.) //Funny, but even 1/120 is not enough, and only 1/240 seems to be stable.
);
and is a total overkill in my case.
My application has no high demand, the 1/60 fixed timestep should be just sufficient, even 1/30.
Reading the docs back and forth, but couldn't pinpoint what else I miss, so any thoughts are appreciated.
More info:
The falling boxes' dimensions are
x 0.5f y 0.5f z 0.5f
in other words, boxes are 1 meter wide, tall, and deep.
Thank you,
A