Why bullet proposes value to clamp number of substeps?

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
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

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

Post by drleviathan »

There is a phenomenon known as the "physics simulation spiral of death" where the real time to compute the world's next state is larger than the timestep itself. On each step the simulation falls further behind. This can happen when the world has too many objects or the objects are too complex. A simple way to exit the spiral is to clamp the number of substeps.
Post Reply