Navigation
API > API/Runtime > API/Runtime/Chaos
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.
| Name | ISimCallbackObject |
| Type | class |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/SimCallbackObject.h |
| Include Path | #include "Chaos/SimCallbackObject.h" |
Syntax
class ISimCallbackObject
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
ISimCallbackObject
(
const ISimCallbackObject& |
Chaos/SimCallbackObject.h | ||
ISimCallbackObject
(
const ESimCallbackOptions InOptions |
Chaos/SimCallbackObject.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ISimCallbackObject() |
Destructor called on internal thread. | Chaos/SimCallbackObject.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bPendingDelete | bool | Chaos/SimCallbackObject.h | ||
| bPendingDelete_External | bool | Chaos/SimCallbackObject.h | ||
| CurrentExternalInput_External | FSimCallbackInput * | Chaos/SimCallbackObject.h | ||
| CurrentInput_Internal | FSimCallbackInput * | Chaos/SimCallbackObject.h | ||
| DeltaTime_Internal | FReal | Chaos/SimCallbackObject.h | ||
| Options | ESimCallbackOptions | TODO: Make this const and remove the "friend class FPhysicsSolverBase" once FPhysicsSolverBase::CreateAndRegisterSimCallbackObject_External(bool, bool) has been deprecated. | Chaos/SimCallbackObject.h | |
| SimTime_Internal | FReal | Chaos/SimCallbackObject.h | ||
| Solver | FPhysicsSolverBase * | Chaos/SimCallbackObject.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplyCorrections_Internal
(
int32 PhysicsStep, |
Chaos/SimCallbackObject.h | ||
void CCDModification_Internal
(
FCCDModifierAccessor& Modifier |
Chaos/SimCallbackObject.h | ||
void ContactModification_Internal
(
FCollisionContactModifier& Modifier |
Chaos/SimCallbackObject.h | ||
void FinalizeOutputData_Internal() |
Chaos/SimCallbackObject.h | ||
virtual void FirstPreResimStep_Internal
(
int32 PhysicsStep |
Chaos/SimCallbackObject.h | ||
void FreeInputData_Internal
(
FSimCallbackInput* Input |
Free the input data. | Chaos/SimCallbackObject.h | |
void FreeOutputData_External
(
FSimCallbackOutput* Output |
Free the output data. | Chaos/SimCallbackObject.h | |
FReal GetDeltaTime_Internal() |
The delta time associated with this simulation step | Chaos/SimCallbackObject.h | |
virtual FName GetFNameForStatId() |
Get a stat name to describe this callback in external profiling and STATS when Named events are enabled | Chaos/SimCallbackObject.h | |
FReal GetSimTime_Internal() |
The point in time when this simulation step begins | Chaos/SimCallbackObject.h | |
const FPhysicsSolverBase * GetSolver () |
Chaos/SimCallbackObject.h | ||
| Chaos/SimCallbackObject.h | |||
bool HasOption
(
const ESimCallbackOptions Option |
Chaos/SimCallbackObject.h | ||
virtual void InjectInputs_External
(
int32 PhysicsStep, |
Chaos/SimCallbackObject.h | ||
virtual bool IsFAsyncObjectManagerCallback() |
Chaos/SimCallbackObject.h | ||
void MidPhaseModification_Internal
(
FMidPhaseModifierAccessor& Modifier |
Chaos/SimCallbackObject.h | ||
void PostInitialize_Internal() |
Chaos/SimCallbackObject.h | ||
void PostIntegrate_Internal() |
Chaos/SimCallbackObject.h | ||
void PostSolve_Internal() |
Chaos/SimCallbackObject.h | ||
void PreIntegrate_Internal() |
Chaos/SimCallbackObject.h | ||
void PreSimulate_Internal() |
Chaos/SimCallbackObject.h | ||
void PreSolve_Internal() |
Chaos/SimCallbackObject.h | ||
virtual void ProcessInputs_External
(
int32 PhysicsStep |
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 | Chaos/SimCallbackObject.h | |
virtual void ProcessInputs_Internal
(
int32 PhysicsStep |
Called before any sim callbacks are triggered but after async inputs has marshaled over Register with ESimCallbackOptions::Rewind to get callback | Chaos/SimCallbackObject.h | |
bool RunOnFrozenGameThread() |
Chaos/SimCallbackObject.h | ||
void StrainModification_Internal
(
FStrainModifierAccessor& Modifier |
Chaos/SimCallbackObject.h | ||
virtual int32 TriggerRewindIfNeeded_Internal
(
int32 LastCompletedStep |
Chaos/SimCallbackObject.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const FSimCallbackInput * GetCurrentInput_Internal() |
Chaos/SimCallbackObject.h | ||
FSimCallbackInput * GetProducerInputData_External() |
Gets the current producer input data. This is what the external thread should be writing to | Chaos/SimCallbackObject.h | |
void SetCurrentInput_Internal
(
FSimCallbackInput* NewInput |
Chaos/SimCallbackObject.h | ||
void SetSimAndDeltaTime_Internal
(
const FReal InSimTime, |
Chaos/SimCallbackObject.h |