Problem with small time steps

timmyl17
Posts: 6
Joined: Sun Oct 30, 2011 12:33 am

Problem with small time steps

Post by timmyl17 »

I need to run very accurate simulations, and I'm seeing some odd behavior when changing the size of the internal time step. I'm new to bullet, so I'm guessing that I'm making a stupid mistake, but I can't seem to find it. When I create a simple sphere and bounce it on a box, everything looks ok when using the default 60 Hz internal time step. When I increase it to 240 Hz, things start to look funky, like not enough impulse is being applied after the collisions. I've modified BasicDemo.cpp and attached it. Just change the constant INTERNAL_TIME_STEP at the top of the file to see the two behaviors. This is with Bullet 2.79. I've also tried building with BT_USE_DOUBLE_PRECISION defined, but the same thing happens. Any help would be greatly appreciated.
You do not have the required permissions to view the files attached to this post.
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: Problem with small time steps

Post by Dr.Shepherd »

I ran your demo, and didn't find the odd stuff you described. Anything wrong?
timmyl17
Posts: 6
Joined: Sun Oct 30, 2011 12:33 am

Re: Problem with small time steps

Post by timmyl17 »

Did you change the time step constant at the top of the file? I guess that with both time steps the simulation looks plausible, but it looks significantly different with different internal time steps. At 60 Hz the ball bounces pretty high (as it should, the elasticity is set pretty high). When the time step is changed to 240 Hz, the bounce is significantly lower. As I understood it, decreasing the time step should just make the simulation more accurate, not change it significantly.

Thanks for looking at this.

-Tim
timmyl17
Posts: 6
Joined: Sun Oct 30, 2011 12:33 am

Re: Problem with small time steps

Post by timmyl17 »

From what I can tell, the restitution is not handled properly when using small time steps. In the BasicDemo I posted, when the time step is set to 60 Hz bounces look ok. If the time step is changed to 1000 Hz, there are no bounces. I'm referring to the internal time step here. Has anyone else seen this problem?
timmyl17
Posts: 6
Joined: Sun Oct 30, 2011 12:33 am

Re: Problem with small time steps

Post by timmyl17 »

This is not as noticeable when two boxes are colliding, as opposed to a sphere and a box. Is there something special about sphere-box collision handling?