UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Chaos::ISimCallbackObject Class Referenceabstract

#include <SimCallbackObject.h>

+ Inheritance diagram for Chaos::ISimCallbackObject:

Public Member Functions

virtual ~ISimCallbackObject ()=default
 
 ISimCallbackObject (const ISimCallbackObject &)=delete
 
FReal GetSimTime_Internal () const
 
FReal GetDeltaTime_Internal () const
 
virtual bool IsFAsyncObjectManagerCallback () const
 
void PostInitialize_Internal ()
 
void PreSimulate_Internal ()
 
void PreIntegrate_Internal ()
 
void PostIntegrate_Internal ()
 
void MidPhaseModification_Internal (FMidPhaseModifierAccessor &Modifier)
 
void CCDModification_Internal (FCCDModifierAccessor &Modifier)
 
void StrainModification_Internal (FStrainModifierAccessor &Modifier)
 
void ContactModification_Internal (FCollisionContactModifier &Modifier)
 
void PreSolve_Internal ()
 
void PostSolve_Internal ()
 
void FinalizeOutputData_Internal ()
 
virtual void FreeOutputData_External (FSimCallbackOutput *Output)=0
 
virtual void FreeInputData_Internal (FSimCallbackInput *Input)=0
 
virtual FName GetFNameForStatId () const
 
FPhysicsSolverBaseGetSolver ()
 
const FPhysicsSolverBaseGetSolver () const
 
virtual void InjectInputs_External (int32 PhysicsStep, int32 NumSteps)
 
virtual void ProcessInputs_Internal (int32 PhysicsStep)
 
virtual void ProcessInputs_External (int32 PhysicsStep)
 
virtual int32 TriggerRewindIfNeeded_Internal (int32 LastCompletedStep)
 
virtual void ApplyCorrections_Internal (int32 PhysicsStep, FSimCallbackInput *Input)
 
virtual void FirstPreResimStep_Internal (int32 PhysicsStep)
 
bool HasOption (const ESimCallbackOptions Option) const
 
bool RunOnFrozenGameThread () const
 

Protected Member Functions

 ISimCallbackObject (const ESimCallbackOptions InOptions=ESimCallbackOptions::Presimulate)
 
CHAOS_API FSimCallbackInputGetProducerInputData_External ()
 
void SetCurrentInput_Internal (FSimCallbackInput *NewInput)
 
void SetSimAndDeltaTime_Internal (const FReal InSimTime, const FReal InDeltaTime)
 
const FSimCallbackInputGetCurrentInput_Internal () const
 

Protected Attributes

FSimCallbackOutputCurrentOutput_Internal
 

Friends

class FPBDRigidsSolver
 
class FPhysicsSolverBase
 
class FChaosMarshallingManager
 
struct FPushPhysicsData
 

Detailed Description

Callback API used for executing code at different points in the simulation. The external thread pushes input data at its own rate (typically once per game thread tick) The internal thread consumes the relevant inputs based on timestamps. For example, if a physics step is 40ms and we tick the game thread at 20ms, the callback would receive 2 inputs per callback (assuming data was pushed every game thread tick) A callback can generate one output to be consumed by the external thread. For example, you could apply a force to an object based on how close the object is to the ground. In this case the game thread may want to know how much force was applied.

This API is also used for resimulating. Because of this, the input data is const and its lifetime is maintained by the internal thread. It is expected that callbacks are "pure" in the sense that they rely only on the input data and affect the simulation in a repeatable and deterministic way. This means that if the same inputs are passed into the callback, we expect the exact same output and that any simulation changes are the same. We rely on this to cache results and skip callbacks when possible during a resim. See functions for more details.

Constructor & Destructor Documentation

◆ ~ISimCallbackObject()

virtual Chaos::ISimCallbackObject::~ISimCallbackObject ( )
virtualdefault

◆ ISimCallbackObject() [1/2]

Chaos::ISimCallbackObject::ISimCallbackObject ( const ISimCallbackObject )
delete

◆ ISimCallbackObject() [2/2]

Chaos::ISimCallbackObject::ISimCallbackObject ( const ESimCallbackOptions  InOptions = ESimCallbackOptions::Presimulate)
inlineprotected

Member Function Documentation

◆ ApplyCorrections_Internal()

virtual void Chaos::ISimCallbackObject::ApplyCorrections_Internal ( int32  PhysicsStep,
FSimCallbackInput Input 
)
inlinevirtual

◆ CCDModification_Internal()

void Chaos::ISimCallbackObject::CCDModification_Internal ( FCCDModifierAccessor Modifier)
inline

◆ ContactModification_Internal()

void Chaos::ISimCallbackObject::ContactModification_Internal ( FCollisionContactModifier Modifier)
inline

◆ FinalizeOutputData_Internal()

void Chaos::ISimCallbackObject::FinalizeOutputData_Internal ( )
inline

◆ FirstPreResimStep_Internal()

virtual void Chaos::ISimCallbackObject::FirstPreResimStep_Internal ( int32  PhysicsStep)
inlinevirtual

◆ FreeInputData_Internal()

virtual void Chaos::ISimCallbackObject::FreeInputData_Internal ( FSimCallbackInput Input)
pure virtual

Free the input data. Note that allocation is done on the external thread, but freeing is done on the internal thread. A common pattern is to use a single producer single consumer thread safe queue to manage this.

◆ FreeOutputData_External()

virtual void Chaos::ISimCallbackObject::FreeOutputData_External ( FSimCallbackOutput Output)
pure virtual

Free the output data. Note that allocation is done on the internal thread, but freeing is done on the external thread. A common pattern is to use a single producer single consumer thread safe queue to manage this.

Implemented in Chaos::FSimCallbackCommandObject, Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >, Chaos::TSimCallbackObject< Chaos::FSimCallbackNoInput, Chaos::FSimCallbackNoOutput, Chaos::ESimCallbackOptions::Presimulate|Chaos::ESimCallbackOptions::RunOnFrozenGameThread >, Chaos::TSimCallbackObject< FAsyncNetworkPhysicsComponentInput, FAsyncNetworkPhysicsComponentOutput, Chaos::ESimCallbackOptions::PhysicsObjectUnregister >, Chaos::TSimCallbackObject< FChaosSceneCallbackInput >, Chaos::TSimCallbackObject< FCharacterMovementComponentAsyncInput, FCharacterMovementComponentAsyncOutput >, Chaos::TSimCallbackObject< FNetworkPhysicsSettingsAsyncInput, Chaos::FSimCallbackNoOutput, Chaos::ESimCallbackOptions::Presimulate >, Chaos::TSimCallbackObject< FPhysicsReplicationAsyncInput, Chaos::FSimCallbackNoOutput, Chaos::ESimCallbackOptions::Presimulate|Chaos::ESimCallbackOptions::PhysicsObjectUnregister >, Chaos::TSimCallbackObject< FPhysicsReplicationCacheAsyncInput, FPhysicsReplicationCacheAsyncOutput, Chaos::ESimCallbackOptions::Presimulate|Chaos::ESimCallbackOptions::PostSolve|Chaos::ESimCallbackOptions::PhysicsObjectUnregister >, and Chaos::TSimCallbackObject< FPhysicsReplicationLODAsyncInput, Chaos::FSimCallbackNoOutput, Chaos::ESimCallbackOptions::Presimulate|Chaos::ESimCallbackOptions::Rewind|Chaos::ESimCallbackOptions::PhysicsObjectUnregister >.

◆ GetCurrentInput_Internal()

const FSimCallbackInput * Chaos::ISimCallbackObject::GetCurrentInput_Internal ( ) const
inlineprotected

◆ GetDeltaTime_Internal()

FReal Chaos::ISimCallbackObject::GetDeltaTime_Internal ( ) const
inline

The delta time associated with this simulation step

◆ GetFNameForStatId()

virtual FName Chaos::ISimCallbackObject::GetFNameForStatId ( ) const
inlinevirtual

Get a stat name to describe this callback in external profiling and STATS when Named events are enabled

Reimplemented in FAsyncPhysicsTickCallback, FCharacterMovementComponentAsyncCallback, Chaos::FSimCallbackCommandObject, and FChaosSceneSimCallback.

◆ GetProducerInputData_External()

FSimCallbackInput * Chaos::ISimCallbackObject::GetProducerInputData_External ( )
protected

Gets the current producer input data. This is what the external thread should be writing to

◆ GetSimTime_Internal()

FReal Chaos::ISimCallbackObject::GetSimTime_Internal ( ) const
inline

The point in time when this simulation step begins

◆ GetSolver() [1/2]

FPhysicsSolverBase * Chaos::ISimCallbackObject::GetSolver ( )
inline

◆ GetSolver() [2/2]

const FPhysicsSolverBase * Chaos::ISimCallbackObject::GetSolver ( ) const
inline

◆ HasOption()

bool Chaos::ISimCallbackObject::HasOption ( const ESimCallbackOptions  Option) const
inline

◆ InjectInputs_External()

virtual void Chaos::ISimCallbackObject::InjectInputs_External ( int32  PhysicsStep,
int32  NumSteps 
)
inlinevirtual

◆ IsFAsyncObjectManagerCallback()

virtual bool Chaos::ISimCallbackObject::IsFAsyncObjectManagerCallback ( ) const
inlinevirtual

◆ MidPhaseModification_Internal()

void Chaos::ISimCallbackObject::MidPhaseModification_Internal ( FMidPhaseModifierAccessor Modifier)
inline

◆ PostInitialize_Internal()

void Chaos::ISimCallbackObject::PostInitialize_Internal ( )
inline

◆ PostIntegrate_Internal()

void Chaos::ISimCallbackObject::PostIntegrate_Internal ( )
inline

◆ PostSolve_Internal()

void Chaos::ISimCallbackObject::PostSolve_Internal ( )
inline

◆ PreIntegrate_Internal()

void Chaos::ISimCallbackObject::PreIntegrate_Internal ( )
inline

◆ PreSimulate_Internal()

void Chaos::ISimCallbackObject::PreSimulate_Internal ( )
inline

◆ PreSolve_Internal()

void Chaos::ISimCallbackObject::PreSolve_Internal ( )
inline

◆ ProcessInputs_External()

virtual void Chaos::ISimCallbackObject::ProcessInputs_External ( int32  PhysicsStep)
inlinevirtual

Called before async inputs are marshaled over to the physics thread, only called if an async input is produced to get marshaled Register with ESimCallbackOptions::Rewind to get callback

◆ ProcessInputs_Internal()

virtual void Chaos::ISimCallbackObject::ProcessInputs_Internal ( int32  PhysicsStep)
inlinevirtual

Called before any sim callbacks are triggered but after async inputs has marshaled over Register with ESimCallbackOptions::Rewind to get callback

◆ RunOnFrozenGameThread()

bool Chaos::ISimCallbackObject::RunOnFrozenGameThread ( ) const
inline

◆ SetCurrentInput_Internal()

void Chaos::ISimCallbackObject::SetCurrentInput_Internal ( FSimCallbackInput NewInput)
inlineprotected

◆ SetSimAndDeltaTime_Internal()

void Chaos::ISimCallbackObject::SetSimAndDeltaTime_Internal ( const FReal  InSimTime,
const FReal  InDeltaTime 
)
inlineprotected

◆ StrainModification_Internal()

void Chaos::ISimCallbackObject::StrainModification_Internal ( FStrainModifierAccessor Modifier)
inline

◆ TriggerRewindIfNeeded_Internal()

virtual int32 Chaos::ISimCallbackObject::TriggerRewindIfNeeded_Internal ( int32  LastCompletedStep)
inlinevirtual

Friends And Related Symbol Documentation

◆ FChaosMarshallingManager

◆ FPBDRigidsSolver

friend class FPBDRigidsSolver
friend

◆ FPhysicsSolverBase

◆ FPushPhysicsData

Member Data Documentation

◆ CurrentOutput_Internal

FSimCallbackOutput* Chaos::ISimCallbackObject::CurrentOutput_Internal
protected

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