How to decrease contact force (Need Help!)

Dear Sir,

If I create 2 objects (lets see 2 boxes) penetrate each other before simulation.
And then when I enable them rigid body dynamics, they will push each other away, but HOW can I control this force, because I think they are moving too fast!! (pushed by too strong force)

Thank you!!’

I cannot imagine what purpose you have to start with -or have- penetrating objects. “Naturally” such behaviour is unfeasible and so you have a strong repulsive force to make the scene sound again. Therefore they are not moving too fast.

If your application requires to modify the contact force you might be interested in the wonders of contact modification via a MyContactModification call-back (see e.g.: https://developer.nvidia.com/sites/default/files/akamai/physx/Docs/Callbacks.html). But I guess you need to find your way through this option on your own. Good luck.

You also may try different restitution forces. Experiment with the materials.

There’s also a method in PxRigidBody that may help you as an alternative to contact modification:

PxRigidBody::setMaxDepenetrationVelocity(PxReal penBias)

It is available from PhysX 3.3.1 onwards. The value you provide is in terms of velocity and defines a clamp on the amount of additional velocity introduced as a result of de-penetration. This is defined per rigid body and, where 2 colliding rigid bodies have different values set, the smaller of the 2 is used to resolve the collisions. You could get a similar effect with contact modification by either clamping the penetration values or adjusting the maximum impulse if you are using an earlier version of PhysX.