PhysX icon indicating copy to clipboard operation
PhysX copied to clipboard

Kinematic to dynamic actor - Uncertain about how PhysX resolves collisions

Open amirbarda opened this issue 4 years ago • 2 comments

Hello,

I have a scenario where I need a simple deformable convex mesh for simulation. As Physx does not allow changing the vertices of of a convex mesh, I recreate it each frame with the required geometry. To handle collisions with the environment, my attempted solution is to use the PxPairFlag::eNOTIFY_TOUCH_FOUND, and to turn on the shape's simulation flag and let PhysX resolve the collision. When the collision is resolved I would turn off the simulation flag and continue.

However, I am not sure what the "collision resolved" flag should be. Is there eNOTIFY_PENETRATION_FOUND flag? Initially, I assumed PhysX resolves the collision within 1 frame, but that does not seem to always be true, even if I set MaxPenetrationVelocity to be the maximum (see attached PVD capture, where the actor penetrates the environment after the update, and is turned to a simulation object, but the penetration is not resolved in the next frame).

PVD

I would appreciate your help. Thank you!

amirbarda avatar Oct 31 '21 10:10 amirbarda

PhysX can't guarantee it will resolve all penetrations in a single frame, so you definitely can't guarantee that. What you could potentially do is use a force thresholds/examine the applied forces to determine when the solver stops applying forces. You could alternatively just examine the set of contacts to determine when separation becomes >= 0.

kstorey-nvidia avatar Nov 02 '21 17:11 kstorey-nvidia

Ok, Thanks for the reply! examining the separation sounds promising, I will try.

amirbarda avatar Nov 02 '21 20:11 amirbarda