Execution Environment: UE 5.7 with async physics tick on
- The following code is generally executed on the Game Thread (GT). The issue is that ‘Proxy->GetParticle_LowLevel()’ retrieves ‘Particle’ data for operation, while the ‘Particle’ data itself is owned by the Physics Thread (PT). Does this result in a Race Condition ?
void FPBDRigidsSolver::UnregisterObject(FSingleParticlePhysicsProxy* Proxy)
{
…
// Null out the particle's proxy pointer
Proxy->GetParticle_LowLevel()->SetProxy(nullptr); //todo: use TUniquePtr for better ownership
...
}
- PhysicsMover performs operations such as ‘FloorSweep’ on the Physics Thread. During the processing of sweep results handling(CollisionConversions → SetHitResultFromShapeAndFaceIndex), it accesses the ‘UserData’ of the PhysicsActor. This ‘UserData’ typically refers to the ‘BodyInstance’ on the Game Thread. The scenario I am currently encountering is:
- GT: SkeletalMeshComponent (named A) is destroyed → delete BodyInstance → pending physics delete command
- PT: A PhysicsMover task (potentially from a previous task dispatch) performs ‘FloorSweep’ → It finds ‘A’ and attempts to dereference its ‘BodyInstance’ → Error …(Crash etc.)
- PT: The physics delete command is executed at new PT frame.
Is this a known issue ? And how to fix it ?