Game Development Reference
In-Depth Information
The stepSimulation() function also accepts two more parameters; the second
parameter is the maximum number of substeps that can be calculated this iteration,
and the third is the desired frequency of step calculations.
If we ask Bullet to perform calculations at a rate of 60 Hz (the third parameter - 60
Hz is also the default), but one second has gone by (maybe our application froze
for a moment), Bullet will make 60 separate step calculations before returning. This
prevents Bullet from jumping every object for one full second in time all at once, and
possibly missing some collisions.
However, calculating so many iterations at once could take a long time to process,
causing our simulation to slow down for a while as it tries to catch up. To solve this,
we can use the second parameter to limit the maximum number of steps it's allowed
to take in case one of these spikes occur. In this case, the world's physics will appear
to slow down, but it also means that your application won't suffer from a long period
of low frame rates.
Search WWH ::

Custom Search