NVIDIAGameWorks / PhysX

NVIDIA PhysX SDK
Other
3.19k stars 809 forks source link

Penetrating collision not being resolved out of one another #658

Closed PhilMaguire closed 7 months ago

PhilMaguire commented 8 months ago

Hi there,

I have a vehicle that has an aggregated (composite?) collision made from various spheres, capsules and boxes. In certain circumstances, mostly when a lot of collisions with other objects are taking place, I can get into a state where a large object is stuck inside my vehicle collision and doesn't get resolved out of it.

Here is a screen grab from a pvd capture. The large box sticking vertically up is the collision on a block that is stuck inside my vehicle's collision.

image

I have disabled all contact modifications I have in our project and anything else that might be injecting forces/impulses/velocities etc into the simulation.

The issue occurs with and without a max depenetration velocity set.

The issue occurs with or without CCD enabled on the collision.

The issue does not occur if I have a single convex collision shape for my vehicle instead of the aggregated collision.

We are using physx through Unreal Engine 4 and are on version 3.4.

Please could you give some advice on why this occurs and what my options might be to avoid it?

I need my composite collision (I am deforming it) so I can't just replace it with a single convex shape.

My feeling is that the physics steps must be trying to resolve the penetration but with so many bodies around it can't iteration to a solution with the block body outside of my vehicle collision. Is this plausible? If not helping to understand why this happens might help me formulate a workaround.

I am going to try adding an extra body that just collides with things like the block that is a single convex shape. I hope that resolves the issue.

Thanks in advance,

Phil

preist-nvidia commented 8 months ago

Your intuition is correct, the solver will struggle with resolving this collision. I assume the vehicle was moving fast when the locking penetration occurs?

Did you try and increase contact offset on the car or block shapes?

Internal tracking: PX-4882