Fix crash when rigidbody gets deleted during physical collision

#1893
This commit is contained in:
Wojtek Figat
2023-11-09 11:50:48 +01:00
parent 710b9275fd
commit 22c8ec5342

View File

@@ -137,7 +137,11 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c
c.ThisActor = static_cast<PhysicsColliderActor*>(pair.shapes[0]->userData);
c.OtherActor = static_cast<PhysicsColliderActor*>(pair.shapes[1]->userData);
ASSERT_LOW_LAYER(c.ThisActor && c.OtherActor);
if (c.ThisActor == nullptr || c.OtherActor == nullptr)
{
// One of the actors was deleted (eg. via RigidBody destroyed by gameplay) then skip processing this collision
continue;
}
// Extract contact points
while (i.hasNextPatch())