Contact forces in Bullet

Post Reply
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Contact forces in Bullet

Post by Ehsanizadi »

Hi,
I'm using Bullet for an engineering simulation and I need to know the contact forces. Is it possible in Bullet?
For example dropping a box on table, can we get the force/impulse induced by the collision between box and table?

What about resting objects on each other? For example a box put on the surface of a table. Would it be possible to get the force that they impose on each other?
If so, could you please help me how?
If not, do you have any idea on how to do that? Does it need heavy coding?

Thank you very much in advance for your comments.
Ehsan
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Contact forces in Bullet

Post by drleviathan »

I don't think Bullet would be a good choice for analyzing forces between touching objects. You'll probably need to use a different physics engine (probably a soft-body simulation).

Does your simulation need to be real-time or can your simulation at offline speeds? A real-time game physics engine often trades high accuracy and detailed state info for speed, and I would expect that to be the case for Bullet.

I'm only 99% sure, but I think the forces are not actually computed for contact points between RigidBody's -- instead final positions and velocities are computed by solving matrices that are formulated using Jacobians of contact constraints.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Contact forces in Bullet

Post by Erwin Coumans »

Yes, the contact forces are available for the contact points. You can iterative over the contact manifolds and over each contact in the manifold. Use the 'm_appliedImpulse' member, and scale it by the delta time to get the applied force (assuming a fixed time step).

The FractureDemo uses this force to determine when to break an object into parts. See this snippet how to access it: https://github.com/bulletphysics/bullet ... d.cpp#L466

@ drleviathan : I am currently working in a robotics group at Google, and improve Bullet towards higher quality contact and other joint simulation.
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Contact forces in Bullet

Post by Ehsanizadi »

Very nice!
Thank you all for your responses.

Ehsan
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Contact forces in Bullet

Post by Ehsanizadi »

Erwin Coumans wrote:Yes, the contact forces are available for the contact points. You can iterative over the contact manifolds and over each contact in the manifold. Use the 'm_appliedImpulse' member, and scale it by the delta time to get the applied force (assuming a fixed time step).

The FractureDemo uses this force to determine when to break an object into parts. See this snippet how to access it: https://github.com/bulletphysics/bullet ... d.cpp#L466

@ drleviathan : I am currently working in a robotics group at Google, and improve Bullet towards higher quality contact and other joint simulation.
What about the forces which exist in static contacts?
For example three boxes are put on top of each other and the system is stable and static. I am wondering the contact forces can be still derived from 'm_appliedImpulse' member?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Contact forces in Bullet

Post by Erwin Coumans »

Yes, Bullet makes no distinction between colliding and resting contact: it just computes constraint forces (or more precise, impulses, but given a fixed time step and the assumptions used in Bullet, constraint impulses are just constraint forces scaled by the time step).
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Contact forces in Bullet

Post by Ehsanizadi »

Thanks Erwin for your reply,

It makes it great for my simulation.
I am currently working on geotechnical engineering related simulations using bullet, so far it is fast and accurate.

Thank you again for providing such a great software, and make it free.

Regards,
Ehsan
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Contact forces in Bullet

Post by Ehsanizadi »

Another question on how getting forces:
How to get forces/impulses in a specific direction?
Assume a case of hundreds of balls moving in different direction and are hitting an object (object X).

How can I get force/impulse applied to object X in x,y or z direction?

Or the force impulses depend on the orientation of contact? Even in this case how to differentiate frictional impulse in an specific direction ?
For example, z-dir is contact normal, so x and y will be two frictional directions of the contact. But in the btPersistentManifold source files, there are two directions of lateral1 and lateral2. But what directions they are?

Sorry for asking many questions! :wink:

Ehsan
Post Reply