FCustomPhysXSyncActors::BuildSyncData_AssumesLocked

Syncing between PhysX and UE4 can be tricky.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/CustomPhysXPayload.h

Include

#include "CustomPhysXPayload.h"

Syntax

void BuildSyncData_AssumesLocked
(
    const TArray< physx::PxRigidActor * > & RigidActors
)

Remarks

Syncing between PhysX and UE4 can be tricky. The challenge is that PhysX gives us an array of raw pointers that require updating. However, UE4 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 UE4 safe structures (see TWeakObjectPtr). The second step updates the actual UE4 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 UE4 component/actors which may trigger a callback. Ideally this should build an array of TWeakObjectPtr, Transform pairs

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss