Yes, you can do it outside the function if you like. So in that sense maxSubSteps gives you nothing extra except the convenience of having it done for you.stenyak wrote:Uhm, i still fail to understand how maxSubSteps solves any problem. The newbie developer already knows how much time he wants to simulate, and what the timeStep is (1/60 by default).
Therefore, he knows *in advance* how many steps will be taken to compute the simulation he asked for (and how that number compares to a possible "maxSubSteps" parameter). Is that correct?
Yeah you're right again, it could be done by the client in an internal step callback or whatever. Bullet doesn't measure the time it itself takes, it just culls steps if it's already done too many. Two different ways of solving the same problem, but measuring time would be much harder to implement portablyAlso, what problem does capping the number of steps solve?
You mentioned two problems:
1) That "too many" steps may have to be computed in order to simulate the desired delta.
2) That steps can take a "too long" time to compute.
Both can lead to locking the physics thread (or the whole program, if it's not multithreaded) until the physics are computed.
The 1) problem can (and IMO should) be addressed by the developer, as explained above. A helper function can be provided by Bullet, but is in no way necessary for the working of Bullet.
The 2) problem can also be solved by Bullet (by returning from stepSimulation if certain time (specified by the user) has elapsed and not all steps, or even not a single step, have been able to be computed), but again IMO it's better addressed by the developer (by profiling the different subsystems of his program, guesstimating the time it'll take to compute things, and acting consequently, for example reducing physics quality, or decreasing graphics detail, or visually warning the user but still allowing sub-realtime gameplay, or stopping the simulation, or sending the multiplayer server an "out of sync due to lack of computing power" message, or whatever).
In my opinion, the 2) problem is the worst of all, and is what would really help the most to the newbie end user.
Now you see why we have had all this discussion about the design