UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions > Class Template Reference

#include <SimCallbackObject.h>

+ Inheritance diagram for Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >:

Public Member Functions

 TSimCallbackObject ()
 
 TSimCallbackObject (bool InRunOnFrozenGameThread)
 
virtual void FreeOutputData_External (FSimCallbackOutput *Output) override
 
TInputTypeGetProducerInputData_External ()
 
const TInputTypeGetConsumerInput_Internal () const
 
TSimCallbackOutputHandle< TOutputTypePopOutputData_External ()
 
TSimCallbackOutputHandle< TOutputTypePopFutureOutputData_External ()
 
bool IsOutputQueueEmpty_External () const
 
TOutputTypeGetProducerOutputData_Internal ()
 
- Public Member Functions inherited from Chaos::ISimCallbackObject
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 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
 

Additional Inherited Members

- Protected Member Functions inherited from Chaos::ISimCallbackObject
 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 inherited from Chaos::ISimCallbackObject
FSimCallbackOutputCurrentOutput_Internal
 

Detailed Description

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
class Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >

Simple templated implementation that uses lock free queues to manage memory

Constructor & Destructor Documentation

◆ TSimCallbackObject() [1/2]

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::TSimCallbackObject ( )
inline

◆ TSimCallbackObject() [2/2]

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::TSimCallbackObject ( bool  InRunOnFrozenGameThread)
inline

Member Function Documentation

◆ FreeOutputData_External()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
virtual void Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::FreeOutputData_External ( FSimCallbackOutput Output)
inlineoverridevirtual

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.

Implements Chaos::ISimCallbackObject.

◆ GetConsumerInput_Internal()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
const TInputType * Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::GetConsumerInput_Internal ( ) const
inline

Get the input associated with the current sim step. This input was provided by the external thread. Note the data could be from a few frames ago

◆ GetProducerInputData_External()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
TInputType * Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::GetProducerInputData_External ( )
inline

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

◆ GetProducerOutputData_Internal()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
TOutputType & Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::GetProducerOutputData_Internal ( )
inline

Gets the current producer output data. This is what the callback generates. If multiple callbacks are triggered in one step, the same output is used

◆ IsOutputQueueEmpty_External()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
bool Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::IsOutputQueueEmpty_External ( ) const
inline

Check if the output queue is empty of data Can be used while iterating the queue through PopOutputData_External and PopFutureOutputData_External to check if the current data is the last data.

◆ PopFutureOutputData_External()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
TSimCallbackOutputHandle< TOutputType > Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::PopFutureOutputData_External ( )
inline

Pop up to the latest output, even if it is in the future. NOTE: It's up to the user to check the internal time of the outputs that this produces. See GetSolver()->GetPhysicsResultsTime_External() for the interpolation time.

A typical example is to pop all of these into a queue, and to interpolate them manually.

◆ PopOutputData_External()

template<typename TInputType = FSimCallbackNoInput, typename TOutputType = FSimCallbackNoOutput, ESimCallbackOptions TOptions = ESimCallbackOptions::Presimulate>
TSimCallbackOutputHandle< TOutputType > Chaos::TSimCallbackObject< TInputType, TOutputType, TOptions >::PopOutputData_External ( )
inline

Gets the output data produced in order up to and including ResultsTime. Typical usage is: while(auto Output = PopOutputData_External()) { //process output }


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