how to find the pressure between two objects in contact

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

how to find the pressure between two objects in contact

Post by yanbo2u »

i have box A and box B. each of them has mass of 1kg.

box A is on top of box B.

how can i find the pressure between box A and box B ?

thank you.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: how to find the pressure between two objects in contact

Post by Norbo »

The impulse applied by the solver during the previous time step can be found in the collision pairs associated with an object. For example, if you have two boxes boxA and boxB, you can analyze their pairs using something like this:

Code: Select all

            float totalImpulse = 0;
            foreach (var pair in boxA.CollisionInformation.Pairs)
            {
                if (pair.EntityA == boxB || pair.EntityB == boxB)
                {
                    //This pair governs the contacts between boxA and boxB. Check its contacts.
                    foreach (var contact in pair.Contacts)
                    {
                        totalImpulse += contact.NormalImpulse;
                    }
                }
            }
A few notes:
1) This is impulse, not force. Impulse is the instantaneous change in momentum computed during the previous solver execution. To compute an approximation of force, divide by the Space.TimeStepSettings.TimeStepDuration.
2) The above assumes that the contact manifold is planar. This is a good assumption for convex-convex pairs, but it does not necessarily hold for concave-convex cases, like a box colliding with a mesh. For those more difficult cases, additional analysis on the contact normals will be needed to split contacts into planar groups.
3) The engine does not explicitly track contact manifold area, so if you want pressure specifically you'll need to approximate the area. Computing area inside the contact positions would be a good start, though it will tend to underestimate the actual area due to contact count limits.
yanbo2u
Posts: 21
Joined: Sun Oct 04, 2015 4:41 pm

Re: how to find the pressure between two objects in contact

Post by yanbo2u »

that is very clear. thank you very much.
Post Reply