/Engine/Source/Runtime/Engine/Public/CustomPhysXPayload.h
Syncing between PhysX and Unreal Engine can be tricky. The challenge is that PhysX gives us an array of raw pointers that require updating. However, Unreal Engine has many mechanisms for triggering arbitrary callbacks. Since the callbacks can invalidate the PhysX data it's critical to break the update into two steps. The first step moves the data from PhysX into Unreal Engine safe structures (seeTWeakObjectPtr). The second step updates the actual Unreal Engine data (components, actors, etc...) It's up to the client code to ensure this is handled correctly. No PhysX raw data should be stored. Do not update component/actor data in step 1 unless you're absolutely sure it will not trigger a callbackThis is step 1 of the sync. Do not store any raw PhysX data or update any Unreal Engine component/actors which may trigger a callback. Ideally this should build an array of TWeakObjectPtr, Transform pairs
void BuildSyncData_AssumesLocked ( const [TArray](API\Runtime\Core\Containers\TArray)< physx::PxRigidActor * > & RigidActors )