UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCustomPhysXSyncActors Struct Referenceabstract

#include <CustomPhysXPayload.h>

Public Member Functions

virtual ~FCustomPhysXSyncActors ()
 
virtual void BuildSyncData_AssumesLocked (const TArray< physx::PxRigidActor * > &RigidActors)=0
 
virtual void FinalizeSync ()=0
 

Friends

class FPhysScene_PhysX
 
class FPhysScene_ImmediatePhysX
 

Detailed Description

This interface allows plugins to sync between physx sim results and Unreal Engine data.

Constructor & Destructor Documentation

◆ ~FCustomPhysXSyncActors()

virtual FCustomPhysXSyncActors::~FCustomPhysXSyncActors ( )
inlinevirtual

Member Function Documentation

◆ BuildSyncData_AssumesLocked()

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

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 (see TWeakObjectPtr). 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 callback This 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<UYourComponent>, Transform pairs

◆ FinalizeSync()

virtual void FCustomPhysXSyncActors::FinalizeSync ( )
pure virtual

This is step 2 of the sync. It's safe to update any Unreal Engine components/actors or trigger callbacks, as long as the code within this function handles it gracefully. For example if a callback destroys some components you will update, make sure to use TWeakObjectPtr

Friends And Related Symbol Documentation

◆ FPhysScene_ImmediatePhysX

friend class FPhysScene_ImmediatePhysX
friend

◆ FPhysScene_PhysX

friend class FPhysScene_PhysX
friend

The documentation for this struct was generated from the following file: