Hi !
I'm experimenting with Bullet to determine if it is the tool I need for a physics simulation project. I plan to move around a rigid body on a plane, with a few constraints, mainly the friction and hinge joints, and log its instant speeds.
Before considering a "complex" scenario, I went to validate some basic newtonian equations. First, I want to apply a constant force to the body and mesure its speed after 5 seconds. Second, I want to measure the effect of friction on the final speed of the body, again after 5 seconds. I actually piggyback on the clientMoveAndDisplay callback to apply forces, display the linear speeds and verify my end condition.
1) The body's mass is 100kg. The friction for both the plane and the body (a simple box, roughly the size of an human) is set to 0. Its initial speed is set to (10, 0 0). A central force of (100, 0, 0) is applied (at each step), so the expected acceleration is 1.0 (F=ma). After 5 seconds, I expect the speed to be 15 unit per second on the X axis (V=V0+at). The simulation indicates 10.7, which is far from the count.
2) Same mass, same initial speed. Friction set at 1 for the plane and 0.01 for the body, resulting in a coefficient U of 0.01. The resulting force is therefore 9.8 (F=mgU). Let's round it a 10. No other forces are applied. I would expect the body to cruise at about 9.5 after 5 seconds (F=ma, a = 0.1, V=V0at). Simulation gives me 9.93.
Are my physics rusty ? Or have I overlooked something in my experimental setup ?
Thanks
Tom
Simple newtonian simulations giving wrong results

 Posts: 85
 Joined: Sun Jan 07, 2007 4:29 pm
 Location: Oxford, England
 Contact:
Re: Simple newtonian simulations giving wrong results
Most physics engines optionally add some simple damping to aid stability. I've not checked, but it may be that Bullet has this nonzero by default.
Re: Simple newtonian simulations giving wrong results
Hi Danny,
Thanks for your response. I've just checked, and with restitution and damping set to 0, for both the plane and the body, I obtain the same result.
Tom
Thanks for your response. I've just checked, and with restitution and damping set to 0, for both the plane and the body, I obtain the same result.
Tom
Re: Simple newtonian simulations giving wrong results
So any update on this ? Can I rely on Bullet for accurate simulations, according to Newtonian physics ?
Tom
Tom
Re: Simple newtonian simulations giving wrong results
Since your problem sounds to be 2dimensional, I think you should simplify things a bit to have more control over the results. You can constrain linear movement to two linear axes and one rotational axis, disable the gravity, and then calculate your own friction forces. See the Box2d demo for some examples.
Bullet uses numerical integration, and the method is called "symplectic euler" (http://en.wikipedia.org/wiki/Semiimplicit_Euler_method). This is a tradeoff between stability, simplicity and accuracy that works well for most cases. So take a look at it and consider if it's good enough for your needs. You can try to make the step size smaller and see if it gives you better results too.
I recommend you to read the source code of at least btDiscreteDynamicsWorld.cpp to get an idea of what is going on in there.
Cheers,
Ola
Bullet uses numerical integration, and the method is called "symplectic euler" (http://en.wikipedia.org/wiki/Semiimplicit_Euler_method). This is a tradeoff between stability, simplicity and accuracy that works well for most cases. So take a look at it and consider if it's good enough for your needs. You can try to make the step size smaller and see if it gives you better results too.
I recommend you to read the source code of at least btDiscreteDynamicsWorld.cpp to get an idea of what is going on in there.
Cheers,
Ola