Merge branch 'charcontroller_terrain_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-charcontroller_terrain_fix

This commit is contained in:
Wojtek Figat
2024-07-18 11:54:46 +02:00

View File

@@ -321,7 +321,12 @@ class CharacterControllerHitReportPhysX : public PxUserControllerHitReport
{
void onHit(const PxControllerHit& hit, Collision& c)
{
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
return;
}
c.Impulse = Vector3::Zero;
c.ThisVelocity = P2C(hit.dir) * hit.length;
c.OtherVelocity = Vector3::Zero;