Physx rigid body dynamics resting contact

Hi,I used PhysX to perform multi-rigid body dynamics simulations and found that there were intersections between rigid bodies after the rigid bodies were stationary.

  1. I wonder why there are intersections

2, How does PhysX handle the intersection when two rigid bodies collide?

  1. How does PhysX handle multiple rigid body resting contacts?

4, Is the rigid body dynamics module in PhysX implemented using PBD?

Hi,
you should display the PhysX SDK colliders and see what the approximation of those objects looks like.
In Window->Physics->Debug you can enable PhysX debug visualization and see how the colliders look like in PhysX directly.
In PhysX you can tune the intersection level on a collider, changing the contact offset and rest offset parameters. By default they are computed based on the size of the object. If negative rest offset is used the objects might intersect.
By default PhysX uses TGS:
https://nvidia-omniverse.github.io/PhysX/physx/5.1.0/docs/RigidBodyDynamics.html#temporal-gauss-seidel

Regards,
Ales

Thank you for your prompt response!

I solve the problem of intersection by adjusting the rest offset. The question is when rest offset=0, why do objects intersect instead of just touching?

I read some papers on rigid body dynamics about collision response and resting contact. Among them are Penalty-based methods, Impulse-based methods and Constraint based methods.

I’m new to rigid body dynamics. There are papers that mention linear complementarity problems(LCP), is TGS an LCP solver?

I would like to know which approach is used in PhysX and how it is possible to stack multiple objects without overlapping.

PhysX is impulse-based. You can find more information in our docs, e.g. here is a good starting point: Advanced Collision Detection — physx 5.2.1 documentation

A good writeup of the fundamentals (we use TGS and PGS) is here: Solver2D :: Box2D

Hope this helps!
Philipp

Thanks!
I will dive into these as soon as possible

I found the following introduction in the function setRestOffset().

“Two shapes will come to rest at a distance equal to the sum of their restOffset values.If the restOffset is 0, they should converge to touching exactly. Having a restOffset greater than zero is useful to have objects slide smoothly, so that they do not get hung up on irregularities of each others’ surfaces.”

Does this mean that when the TGS solver handles resting contacts, it cannot make two stacked objects touch exactly without overlapping in a finite number of iterations?

I created a few stacked in the PhysX cube, and then use the function PxSceneQueryExt::overlapMultiple (*scene, geometryHolder.any(), pose, hitOv.get(), 4096, PxQueryFilterData(PxQueryFlag::eANY_HIT | PxQueryFlag::eDYNAMIC)) query overlapping number. The geometryHolder is one of these cube. * The function returns a value greater than 1.

In addition, how does the RestOffset work? How to set an appropriate RestOffset value such that there is no intersection between objects?

I don’t think you can solve this with the rest offset, but it’s a problem of not allowing for any penetration at all - I would use a small threshold on the penetration depth. You could use the contact reports for this: Simulate, evaluate the contact reports’ penetration and allow some small penetration and still determine that there is no overlap.