UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp > Class Template Reference

#include <PhysicsProxy.h>

+ Inheritance diagram for TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >:

Public Types

using FParticleType = Concrete
 
using FParticlesType = Chaos::FPBDRigidParticles
 
using FIntArray = Chaos::TArrayCollectionArray< int32 >
 

Public Member Functions

 TPhysicsProxy ()
 
 TPhysicsProxy (UObject *InOwner)
 
virtual ~TPhysicsProxy ()
 
bool IsSimulating () const
 
void UpdateKinematicBodiesCallback (const FParticlesType &InParticles, const float InDt, const float InTime, FKinematicProxy &InKinematicProxy)
 
void StartFrameCallback (const float InDt, const float InTime)
 
void EndFrameCallback (const float InDt)
 
void CreateRigidBodyCallback (FParticlesType &InOutParticles)
 
void DisableCollisionsCallback (TSet< TTuple< int32, int32 > > &InPairs)
 
void AddForceCallback (FParticlesType &InParticles, const float InDt, const int32 InIndex)
 
void BindParticleCallbackMapping (Chaos::TArrayCollectionArray< PhysicsProxyWrapper > &PhysicsProxyReverseMap, Chaos::TArrayCollectionArray< int32 > &ParticleIDReverseMap)
 
void ClearAccumulatedData ()
 
void SyncBeforeDestroy ()
 
void OnRemoveFromScene ()
 
bool IsDirty ()
 
voidGetUserData () const
 
Chaos::FRigidTransform3 GetTransform () const
 
FORCEINLINE_DEBUGGABLE TProxyTimeStampGetSyncTimestampTyped ()
 
- Public Member Functions inherited from IPhysicsProxyBase
 IPhysicsProxyBase (EPhysicsProxyType InType, UObject *InOwner, TSharedPtr< FProxyTimestampBase, ESPMode::ThreadSafe > InProxyTimeStamp)
 
UObjectGetOwner () const
 
template<class SOLVER_TYPE >
SOLVER_TYPEGetSolver () const
 
Chaos::FPhysicsSolverBaseGetSolverBase () const
 
template<class SOLVER_TYPE = Chaos::FPhysicsSolver>
void SetSolver (SOLVER_TYPE *InSolver)
 
EPhysicsProxyType GetType () const
 
virtual voidGetHandleUnsafe () const
 
int32 GetDirtyIdx () const
 
void SetDirtyIdx (const int32 Idx)
 
void ResetDirtyIdx ()
 
void MarkDeleted ()
 
bool GetMarkedDeleted () const
 
TSharedPtr< FProxyTimestampBase, ESPMode::ThreadSafeGetSyncTimestamp () const
 
bool IsInitialized () const
 
void SetInitialized (const int32 InitializeStep)
 
int32 GetInitializedStep () const
 
int32 GetIgnoreDataOnStep_Internal () const
 
IPhysicsProxyBaseGetParentProxy () const
 
void SetParentProxy (IPhysicsProxyBase *InProxy)
 

Static Public Member Functions

static constexpr EPhysicsProxyType ConcreteType ()
 
- Static Public Member Functions inherited from IPhysicsProxyBase
static float GetRenderInterpErrorCorrectionDuration ()
 
static float GetRenderInterpMaximumErrorCorrectionBeforeSnapping ()
 
static float GetRenderInterpErrorVelocitySmoothingDuration ()
 
static bool GetRenderInterpDebugDraw ()
 
static float GetRenderInterpErrorDirectionalDecayMultiplier ()
 

Additional Inherited Members

- Protected Member Functions inherited from IPhysicsProxyBase
virtual CHAOS_API ~IPhysicsProxyBase ()
 
template<typename TProxyTimeStamp >
FORCEINLINE_DEBUGGABLE TProxyTimeStampGetSyncTimestampAs ()
 
CHAOS_API int32 GetSolverSyncTimestamp_External () const
 
- Protected Attributes inherited from IPhysicsProxyBase
Chaos::FPhysicsSolverBaseSolver
 
UObjectOwner
 
EPhysicsProxyType Type
 
int32 InitializedOnStep = INDEX_NONE
 
int32 IgnoreDataOnStep_Internal = INDEX_NONE
 

Detailed Description

template<class Concrete, class ConcreteData, typename TProxyTimeStamp>
class TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >

Base object interface for solver objects. Defines the expected API for objects uses CRTP for static dispatch, entire API considered "pure-virtual" and must be* defined. Forgetting to implement any of the interface functions will give errors regarding recursion on all control paths for TPhysicsProxy<T> where T will be the type that has not correctly implemented the API.

PersistentTask uses IPhysicsProxyBase, so when implementing a new specialized type it is necessary to include its header file in PersistentTask.cpp allowing the linker to properly resolve the new type.

May not be necessary overall once the engine has solidified - we can just use the final concrete objects but this gives us almost the same flexibility as the old callbacks while solving most of the drawbacks (virtual dispatch, cross-object interaction)

BG TODO - rename the callbacks functions, document for the base solver object

Member Typedef Documentation

◆ FIntArray

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
using TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::FIntArray = Chaos::TArrayCollectionArray<int32>

◆ FParticlesType

◆ FParticleType

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
using TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::FParticleType = Concrete

Constructor & Destructor Documentation

◆ TPhysicsProxy() [1/2]

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::TPhysicsProxy ( )
inline

◆ TPhysicsProxy() [2/2]

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::TPhysicsProxy ( UObject InOwner)
inlineexplicit

◆ ~TPhysicsProxy()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
virtual TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::~TPhysicsProxy ( )
inlinevirtual

Virtual destructor for derived objects, ideally no other virtuals should exist in this chain

Member Function Documentation

◆ AddForceCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::AddForceCallback ( FParticlesType InParticles,
const float  InDt,
const int32  InIndex 
)
inline

◆ BindParticleCallbackMapping()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::BindParticleCallbackMapping ( Chaos::TArrayCollectionArray< PhysicsProxyWrapper > &  PhysicsProxyReverseMap,
Chaos::TArrayCollectionArray< int32 > &  ParticleIDReverseMap 
)
inline

The Particle Binding creates a connection between the particles in the simulation and the solver objects dataset.

◆ ClearAccumulatedData()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::ClearAccumulatedData ( )
inline

CONTEXT: GAMETHREAD Returns a new unmanaged allocation of the data saved on the handle, otherwise nullptr CONTEXT: GAMETHREAD -> to -> PHYSICSTHREAD Called on the game thread when the solver is about to advance forward. This callback should Enqueue commands on the PhysicsThread to update the state of the solver CONTEXT: GAMETHREAD Called on game thread after NewData has been called to buffer the particle data for physics. The purpose of this method is to clear data, such as external force and torque, which have been accumulated over a game tick. Buffering these values once means they'll be accounted for in physics. If they are not cleared, then they may "overaccumulate".

◆ ConcreteType()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
static constexpr EPhysicsProxyType TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::ConcreteType ( )
inlinestaticconstexpr

Returns the concrete type of the derived class

◆ CreateRigidBodyCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::CreateRigidBodyCallback ( FParticlesType InOutParticles)
inline

◆ DisableCollisionsCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::DisableCollisionsCallback ( TSet< TTuple< int32, int32 > > &  InPairs)
inline

◆ EndFrameCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::EndFrameCallback ( const float  InDt)
inline

◆ GetSyncTimestampTyped()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
FORCEINLINE_DEBUGGABLE TProxyTimeStamp & TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::GetSyncTimestampTyped ( )
inline

◆ GetTransform()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
Chaos::FRigidTransform3 TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::GetTransform ( ) const
inline

◆ GetUserData()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void * TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::GetUserData ( ) const
inline

◆ IsDirty()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
bool TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::IsDirty ( )
inline

◆ IsSimulating()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
bool TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::IsSimulating ( ) const
inline

The following functions are to be implemented by all solver objects as we're using CRTP / F-Bound to statically dispatch the calls. Any common functions should be added here and to the derived solver objects

◆ OnRemoveFromScene()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::OnRemoveFromScene ( )
inline

CONTEXT: PHYSICSTHREAD Called on the physics thread when the engine is shutting down the proxy and we need to remove it from any active simulations. Proxies are expected to entirely clean up their simulation state within this method. This is run in the task command step by the scene so the simulation will currently be idle

◆ StartFrameCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::StartFrameCallback ( const float  InDt,
const float  InTime 
)
inline

◆ SyncBeforeDestroy()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::SyncBeforeDestroy ( )
inline

CONTEXT: GAMETHREAD Called during the gamethread sync after the proxy has been removed from its solver intended for final handoff of any data the proxy has that the gamethread may be interested in

◆ UpdateKinematicBodiesCallback()

template<class Concrete , class ConcreteData , typename TProxyTimeStamp >
void TPhysicsProxy< Concrete, ConcreteData, TProxyTimeStamp >::UpdateKinematicBodiesCallback ( const FParticlesType InParticles,
const float  InDt,
const float  InTime,
FKinematicProxy InKinematicProxy 
)
inline

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