Why bullet proposes value to clamp number of substeps?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Yola
Posts: 10
Joined: Wed Oct 24, 2018 8:38 am

Why bullet proposes value to clamp number of substeps?

Post by Yola »

Why bullet needs maxSubSteps at all? Why to clamp value at all? In the code i saw the following comment:

Code: Select all

    //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
    int clampedSimulationSteps = (numSimulationSubSteps > maxSubSteps) ? maxSubSteps : numSimulationSubSteps;
What does it mean?
code wrote: simulation grinding spiralling down
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Why bullet proposes value to clamp number of substeps?

Post by Erwin Coumans »

Clamping is important in real-time simulations, otherwise you get a feedback loop of slower and slower (grinding to a halt) if the time it takes to simulate is slower then the real-time clock.

Code: Select all

dt = clock.deltaTime();
stepSimulation(dt);//if this takes longer than dt, then the next iteration, the dt will be larger, and stepSimulation also takes longer etc etc.
Post Reply