ISimCallbackObject

Callback API used for executing code at different points in the simulation.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Chaos

Header

/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/SimCallbackObject.h

Include

#include "Chaos/SimCallbackObject.h"

Syntax

class ISimCallbackObject

Remarks

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.

Variables

Name Description

Protected variable

FSimCallbackOut...

 

CurrentOutput_Internal

Constructors

Name Description

Protected function

ISimCallbackObject()

Public function

ISimCallbackObject

(
    const ISimCallbackObject&
)

Destructors

Name Description

Public function Virtual

~ISimCallbackObject()

Destructor called on internal thread.

Functions

Name Description

Public function

void

 

ContactModification_Internal

(
    const TArrayView< FPBDCollisionCons...
)

Public function

void

 

FinalizeOutputData_Internal()

Public function

void

 

FreeInputData_Internal

(
    FSimCallbackInput* Input
)

Free the input data.

Public function

void

 

FreeOutputData_External

(
    FSimCallbackOutput* Output
)

Free the output data.

Protected function Const

const FSimCa...

 

GetCurrentInput_Internal()

Public function Const

FReal

 

GetDeltaTime_Internal()

The delta time associated with this simulation step

Protected function

FSimCallback...

 

GetProducerInputData_External()

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

Public function Const

FReal

 

GetSimTime_Internal()

The point in time when this simulation step begins

Public function

FPhysicsSolv...

 

GetSolver()

Public function Virtual Const

bool

 

IsFAsyncObjectManagerCallback()

Public function

void

 

PreSimulate_Internal()

Protected function

void

 

SetCurrentInput_Internal

(
    FSimCallbackInput* NewInput
)

Protected function

void

 

SetSimAndDeltaTime_Internal

(
    const FReal InSimTime,
    const FReal InDeltaTime
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss