TPhysicsProxy

Base object interface for solver objects.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Chaos

Header

/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Framework/PhysicsProxy.h

Include

#include "Chaos/Framework/PhysicsProxy.h"

Syntax

template<class Concrete, class ConcreteData>
class TPhysicsProxy : public IPhysicsProxyBase

Remarks

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

Constructors

Name Description

Public function

TPhysicsProxy()

Public function

TPhysicsProxy

(
    UObject* InOwner
)

Destructors

Name Description

Public function Virtual

~TPhysicsProxy()

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

Functions

Name Description

Public function

void

 

AddForceCallback

(
    FParticlesType& InParticles,
    const float InDt,
    const int32 InIndex
)

Public function

void

 

BindParticleCallbackMapping

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

Public function

void

 

BufferCommand

(
    Chaos::FPhysicsSolver* InSolve...,
    const FFieldSystemCommand& InComma...
)

Called to buffer a command to be processed at the next available safe opportunity

Public function

void

 

BufferPhysicsResults()

CONTEXT: PHYSICSTHREAD Called per-tick after the simulation has completed.

Public function

void

 

ClearAccumulatedData()

CONTEXT: GAMETHREAD Called on game thread after NewData has been called to buffer the particle data for physics.

Public function

EPhysicsProx...

 

ConcreteType()

Returns the concrete type of the derived class

Public function

void

 

CreateRigidBodyCallback

(
    FParticlesType& InOutParticles
)

Public function

void

 

DisableCollisionsCallback

(
    TSet< TTuple< int32, int32 >>& InP...
)

Public function

void

 

EndFrameCallback

(
    const float InDt
)

Public function

void

 

FieldForcesUpdateCallback

(
    Chaos::FPhysicsSolver* InSolve...,
    FParticlesType& Particles,
    Chaos::TArrayCollectionArray< FVect...,
    Chaos::TArrayCollectionArray< FVect...,
    const float Time
)

Public function

void

 

FlipBuffer()

CONTEXT: PHYSICSTHREAD (Write Locked) Called by the physics thread to signal that it is safe to perform any double-buffer flips here.

Public function Const

Chaos::TRigi...

 

GetTransform()

Public function Const

void *

 

GetUserData()

Public function

bool

 

IsDirty()

Public function Const

bool

 

IsSimulating()

Previously callback related functions, all called in the context of the physics thread if enabled.

Public function

Chaos::FPart...

 

NewData()

CONTEXT: GAMETHREAD Returns a new unmanaged allocation of the data saved on the handle, otherwise nullptr

Public function

void

 

OnRemoveFromScene()

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.

Public function

void

 

ParameterUpdateCallback

(
    FParticlesType& InParticles,
    const float InTime
)

Public function

void

 

PullFromPhysicsState()

CONTEXT: GAMETHREAD (Read Locked) Perform a similar operation to Sync, but take the data from a gamethread-safe buffer.

Public function

void

 

PushToPhysicsState

(
    const Chaos::FParticleData* In...
)

CONTEXT: GAMETHREAD -> to -> PHYSICSTHREAD Called on the game thread when the solver is about to advance forward.

Public function

void

 

StartFrameCallback

(
    const float InDt,
    const float InTime
)

Public function

void

 

SyncBeforeDestroy()

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

Public function

void

 

UpdateKinematicBodiesCallback

(
    const FParticlesType& InParticles,
    const float InDt,
    const float InTime,
    FKinematicProxy& InKinematicProxy
)

Overridden from IPhysicsProxyBase

Name Description

Public function Virtual Const

UObject *...

 

GetOwner()

Gets the owning external object for this solver object, never used internally

Typedefs

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