I'm having a problem where if I specify maxSubSteps > 1 in the physics step any object in the scene that I have initially rotating will spin at a ridiculous speed.
Any idea why this could be?
Initial Angular Velocity
-
- Posts: 3
- Joined: Sun Oct 02, 2011 8:32 pm
Initial Angular Velocity
Last edited by Makail on Sun Oct 02, 2011 8:46 pm, edited 1 time in total.
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Initial Angular Velocity
What's your parameters for timeStep, maxSubSteps and fixedTimeStep?
Code: Select all
btDynamicsWorld::stepSimulation(
btScalar timeStep,
int maxSubSteps=1,
btScalar fixedTimeStep=btScalar(1.)/btScalar(60.));
-
- Posts: 3
- Joined: Sun Oct 02, 2011 8:32 pm
Re: Initial Angular Velocity
Elapsed time between frames (in seconds), 4 sub steps, and 1/30.0f.
Edit: First post should have maxSubSteps > 1. Not 0.
Edit: First post should have maxSubSteps > 1. Not 0.
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Initial Angular Velocity
You can just print "Elapsed time between frames (in seconds)" out, and see how big it is approximately.
The substep time size is 1/30, your max substep is 4, so it can go as far as 4*1/30=0.133333 (s)
Oh jesus, this should be ok. Are you sure that the problem is this MaxSubStep variable ?
The substep time size is 1/30, your max substep is 4, so it can go as far as 4*1/30=0.133333 (s)
Oh jesus, this should be ok. Are you sure that the problem is this MaxSubStep variable ?
-
- Posts: 3
- Joined: Sun Oct 02, 2011 8:32 pm
Re: Initial Angular Velocity
My elapsed time checks out, it comes in at ~0.033sec. Reducing the number of steps to 1 causes the object to rotate with the correct velocity. It might also be worth noting that if I pass in exactly 1/30.0 as the elapsed time the initial velocity is correct as well.
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: Initial Angular Velocity
I don't clearly understand the mechanism, your values satisfy the condition that:
timestep < maxSubStep * fixedTimeStep
But I did try some experiments on my BasicDemo, and it works in a strange way, definitely there is something wrong or special points we don't notice.
timestep < maxSubStep * fixedTimeStep
But I did try some experiments on my BasicDemo, and it works in a strange way, definitely there is something wrong or special points we don't notice.