If the static mesh has UseSimpleCollisionAsComplex and does not have any SimpleCollision shapes, The physics actor will be destroyed immediately in FInitBodiesHelperBase::CreateShapesAndActors, but since it is before the scene is added, the PhysicsActor will be delayed until the persistent level is destroyed.
This can be fatal for titles which use switching sublevels repeatedly without changing persistent level.
Here's a fix
// Takes actor ref arrays. // #PHYS2 this used to return arrays of low-level physics bodies, which would be added to scene in InitBodies. Should it still do that, rather then later iterate over BodyInstances to get phys actor refs? bool FInitBodiesHelperBase::CreateShapesAndActors() { ...omitted... CreateActor_AssumesLocked(Instance, Transform); const bool bInitFail = CreateShapes_AssumesLocked(Instance); if (bInitFail) { #if WITH_EDITOR //In the editor we may have ended up here because of world trace ignoring our EnableCollision. Since we can't get at the data in that function we check for it here if(!PrimitiveComp || PrimitiveComp->IsCollisionEnabled()) #endif { UE_LOG(LogPhysics, Log, TEXT("Init Instance %d of Primitive Component %s failed. Does it have collision data available?"), BodyIdx, *PrimitiveComp->GetReadableName()); } #if 0 FPhysicsInterface::ReleaseActor(Instance->ActorHandle, PhysScene ); #else // this is the workaround FPhysicsInterface::ReleaseActor(Instance->ActorHandle, PhysScene, true/*bNeverDeferRelease*/ ); #endif Instance->OwnerComponent = nullptr; Instance->BodySetup = nullptr; Instance->ExternalCollisionProfileBodySetup = nullptr; continue; } FPhysicsInterface::SetActorUserData_AssumesLocked(Instance->ActorHandle, &Instance->PhysicsUserData); } return true; }
Each time displaying the sublevel increase PhysX memory by around 10 KBytes.
[Link Removed]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-113811 in the post.
1 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.25 |
Created | Apr 19, 2021 |
---|---|
Updated | Feb 1, 2023 |