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

#include <RewindData.h>

Public Member Functions

 FRewindData (FPBDRigidsSolver *InSolver, int32 NumFrames, bool InRewindDataOptimization, int32 InCurrentFrame)
 
 FRewindData (FPBDRigidsSolver *InSolver, int32 NumFrames, int32 InCurrentFrame)
 
void Init (FPBDRigidsSolver *InSolver, int32 NumFrames, bool InRewindDataOptimization, int32 InCurrentFrame)
 
void Init (FPBDRigidsSolver *InSolver, int32 NumFrames, int32 InCurrentFrame)
 
int32 Capacity () const
 
int32 CurrentFrame () const
 
int32 GetLatestFrame () const
 
int32 GetFramesSaved () const
 
FReal GetDeltaTimeForFrame (int32 Frame) const
 
void RemoveObject (const FGeometryParticleHandle *Particle, const EAllowShrinking AllowShrinking=EAllowShrinking::Default)
 
FORCEINLINE void RemoveObject (const FGeometryParticleHandle *Particle, const bool bAllowShrinking)
 
void RemoveObject (const FPBDJointConstraintHandle *Joint, const EAllowShrinking AllowShrinking=EAllowShrinking::Default)
 
FORCEINLINE void RemoveObject (const FPBDJointConstraintHandle *Joint, const bool bAllowShrinking)
 
int32 GetEarliestFrame_Internal () const
 
void CHAOS_API ExtendHistoryWithFrame (const int32 Frame)
 
void CHAOS_API ClearPhaseAndFuture (FGeometryParticleHandle &Handle, int32 Frame, FFrameAndPhase::EParticleHistoryPhase Phase)
 
void CHAOS_API PushStateAtFrame (FGeometryParticleHandle &Handle, int32 Frame, FFrameAndPhase::EParticleHistoryPhase Phase, const FVector &Position, const FQuat &Quaternion, const FVector &LinVelocity, const FVector &AngVelocity, const bool bShouldSleep)
 
void CHAOS_API SetTargetStateAtFrame (FGeometryParticleHandle &Handle, const int32 Frame, FFrameAndPhase::EParticleHistoryPhase Phase, const FVector &Position, const FQuat &Quaternion, const FVector &LinVelocity, const FVector &AngVelocity, const bool bShouldSleep)
 
void ExtractHistoryState (FGeometryParticleHandle &Handle, int32 &PositionValidCount, int32 &VelocityValidCount, int32 &PositionNextIterator, int32 &VelocityNextIterator)
 
void RestoreHistoryState (FGeometryParticleHandle &Handle, const int32 &PositionValidCount, const int32 &VelocityValidCount, const int32 &PositionNextIterator, const int32 &VelocityNextIterator)
 
FGeometryParticleState CHAOS_API GetPastStateAtFrame (const FGeometryParticleHandle &Handle, int32 Frame, FFrameAndPhase::EParticleHistoryPhase Phase=FFrameAndPhase::EParticleHistoryPhase::PostPushData) const
 
FJointState CHAOS_API GetPastJointStateAtFrame (const FPBDJointConstraintHandle &Handle, int32 Frame, FFrameAndPhase::EParticleHistoryPhase Phase=FFrameAndPhase::EParticleHistoryPhase::PostPushData) const
 
IResimCacheBaseGetCurrentStepResimCache () const
 
void CHAOS_API DumpHistory_Internal (const int32 FramePrintOffset, const FString &Filename=FString(TEXT("Dump")))
 
bool GetUseCollisionResimCache () const
 
template<typename CreateCache >
void AdvanceFrame (FReal DeltaTime, const CreateCache &CreateCacheFunc)
 
void FinishFrame ()
 
bool IsResim () const
 
bool IsFinalResim () const
 
int32 GetNumDirtyParticles () const
 
void PushGTDirtyData (const FDirtyPropertiesManager &SrcManager, const int32 SrcDataIdx, const FDirtyProxy &Dirty, const FShapeDirtyData *ShapeDirtyData)
 
void PushPTDirtyData (TPBDRigidParticleHandle< FReal, 3 > &Rigid, const int32 SrcDataIdx)
 
void CHAOS_API MarkDirtyFromPT (FGeometryParticleHandle &Handle)
 
void CHAOS_API MarkDirtyJointFromPT (FPBDJointConstraintHandle &Handle)
 
void CHAOS_API SpawnProxyIfNeeded (FSingleParticlePhysicsProxy &Proxy)
 
void AddInputHistory (const TSharedPtr< FBaseRewindHistory > &InputHistory)
 
void RemoveInputHistory (const TSharedPtr< FBaseRewindHistory > &InputHistory)
 
void AddInputHistory (const TSharedPtr< FBaseRewindHistory > &InputHistory, Chaos::FGeometryParticleHandle *Particle)
 
void RemoveInputHistory (const TSharedPtr< FBaseRewindHistory > &InputHistory, Chaos::FGeometryParticleHandle *Particle)
 
void AddStateHistory (const TSharedPtr< FBaseRewindHistory > &StateHistory)
 
void RemoveStateHistory (const TSharedPtr< FBaseRewindHistory > &StateHistory)
 
void AddStateHistory (const TSharedPtr< FBaseRewindHistory > &StateHistory, Chaos::FGeometryParticleHandle *Particle)
 
void RemoveStateHistory (const TSharedPtr< FBaseRewindHistory > &StateHistory, Chaos::FGeometryParticleHandle *Particle)
 
void ApplyInputs (const int32 ApplyFrame, const bool bResetSolver)
 
void RewindStates (const int32 RewindFrame, const bool bResetSolver)
 
void BufferPhysicsResults (TMap< const IPhysicsProxyBase *, struct FDirtyRigidParticleReplicationErrorData > &DirtyRigidErrors)
 
const FPBDRigidsSolverGetSolver () const
 
int32 CHAOS_API FindValidResimFrame (const int32 RequestedFrame)
 
const int32 GetResimFrame () const
 
void SetResimFrame (int32 Frame)
 
bool IsFrameWithinRewindHistory (int32 Frame)
 
void CHAOS_API RequestResimulation (int32 RequestedFrame, Chaos::FGeometryParticleHandle *Particle=nullptr)
 
void BlockResim ()
 
const int32 GetBlockedResimFrame () const
 
void SetRewindDataOptimization (bool InRewindDataOptimization)
 
const int32 CHAOS_API CompareTargetsToLastFrame ()
 
template<>
void AccumulateErrorIfNecessary (FGeometryParticleHandle &Obj, const FFrameAndPhase FrameAndPhase)
 

Static Public Member Functions

static bool CHAOS_API CheckVectorThreshold (FVec3 A, FVec3 B, float Threshold)
 
static bool CHAOS_API CheckQuaternionThreshold (FQuat A, FQuat B, float ThresholdDegrees)
 

Friends

class FPBDRigidsSolver
 

Constructor & Destructor Documentation

◆ FRewindData() [1/2]

Chaos::FRewindData::FRewindData ( FPBDRigidsSolver InSolver,
int32  NumFrames,
bool  InRewindDataOptimization,
int32  InCurrentFrame 
)

◆ FRewindData() [2/2]

Chaos::FRewindData::FRewindData ( FPBDRigidsSolver InSolver,
int32  NumFrames,
int32  InCurrentFrame 
)

Member Function Documentation

◆ AccumulateErrorIfNecessary()

template<>
void Chaos::FRewindData::AccumulateErrorIfNecessary ( FGeometryParticleHandle Obj,
const FFrameAndPhase  FrameAndPhase 
)

◆ AddInputHistory() [1/2]

void Chaos::FRewindData::AddInputHistory ( const TSharedPtr< FBaseRewindHistory > &  InputHistory)
inline

Add input history to the rewind data for future use while resimulating

◆ AddInputHistory() [2/2]

void Chaos::FRewindData::AddInputHistory ( const TSharedPtr< FBaseRewindHistory > &  InputHistory,
Chaos::FGeometryParticleHandle Particle 
)
inline

Add input history for particle to the rewind data

◆ AddStateHistory() [1/2]

void Chaos::FRewindData::AddStateHistory ( const TSharedPtr< FBaseRewindHistory > &  StateHistory)
inline

Add state history to the rewind data for future use while rewinding

◆ AddStateHistory() [2/2]

void Chaos::FRewindData::AddStateHistory ( const TSharedPtr< FBaseRewindHistory > &  StateHistory,
Chaos::FGeometryParticleHandle Particle 
)
inline

Add state history for particle to the rewind data

◆ AdvanceFrame()

template<typename CreateCache >
void Chaos::FRewindData::AdvanceFrame ( FReal  DeltaTime,
const CreateCache CreateCacheFunc 
)
inline

Called just before physics is solved

◆ ApplyInputs()

void Chaos::FRewindData::ApplyInputs ( const int32  ApplyFrame,
const bool  bResetSolver 
)

Apply inputs for specified frame from rewind data

◆ BlockResim()

void Chaos::FRewindData::BlockResim ( )

This blocks any future resimulation to rewind back past the frame this is called on

◆ BufferPhysicsResults()

void Chaos::FRewindData::BufferPhysicsResults ( TMap< const IPhysicsProxyBase *, struct FDirtyRigidParticleReplicationErrorData > &  DirtyRigidErrors)

Move post-resim error correction data from RewindData to FPullPhysicsData for marshaling to GT where it can be used in render interpolation

◆ Capacity()

int32 Chaos::FRewindData::Capacity ( ) const
inline

◆ CheckQuaternionThreshold()

bool Chaos::FRewindData::CheckQuaternionThreshold ( FQuat  A,
FQuat  B,
float  ThresholdDegrees 
)
static

◆ CheckVectorThreshold()

bool Chaos::FRewindData::CheckVectorThreshold ( FVec3  A,
FVec3  B,
float  Threshold 
)
static

◆ ClearPhaseAndFuture()

void Chaos::FRewindData::ClearPhaseAndFuture ( FGeometryParticleHandle Handle,
int32  Frame,
FFrameAndPhase::EParticleHistoryPhase  Phase 
)

◆ CompareTargetsToLastFrame()

const int32 Chaos::FRewindData::CompareTargetsToLastFrame ( )

Check if we have received targets already for the last frame simulated, if so compare those with the result of the simulation and if they desync return the frame value to request a rewind for to correct the desync NOTE: This only happens when the client has desynced and is behind the server, so we receive server states for frames not yet simulated

◆ CurrentFrame()

int32 Chaos::FRewindData::CurrentFrame ( ) const
inline

◆ DumpHistory_Internal()

void Chaos::FRewindData::DumpHistory_Internal ( const int32  FramePrintOffset,
const FString &  Filename = FString(TEXT("Dump")) 
)

◆ ExtendHistoryWithFrame()

void Chaos::FRewindData::ExtendHistoryWithFrame ( const int32  Frame)

◆ ExtractHistoryState()

void Chaos::FRewindData::ExtractHistoryState ( FGeometryParticleHandle Handle,
int32 PositionValidCount,
int32 VelocityValidCount,
int32 PositionNextIterator,
int32 VelocityNextIterator 
)
inline

Extract some history information before cleaning/pushing state

◆ FindValidResimFrame()

int32 Chaos::FRewindData::FindValidResimFrame ( const int32  RequestedFrame)

Find the first previous valid frame having received physics target from the server

If the particle needs resim, add it to the IslandValidationIslandParticles array to ensure it will be processed particles that are not in contact with anything doesn't have an island and would be missed

◆ FinishFrame()

void Chaos::FRewindData::FinishFrame ( )

◆ GetBlockedResimFrame()

const int32 Chaos::FRewindData::GetBlockedResimFrame ( ) const
inline

Get the latest frame resim has been blocked from rewinding past

◆ GetCurrentStepResimCache()

IResimCacheBase * Chaos::FRewindData::GetCurrentStepResimCache ( ) const
inline

◆ GetDeltaTimeForFrame()

FReal Chaos::FRewindData::GetDeltaTimeForFrame ( int32  Frame) const
inline

◆ GetEarliestFrame_Internal()

int32 Chaos::FRewindData::GetEarliestFrame_Internal ( ) const
inline

◆ GetFramesSaved()

int32 Chaos::FRewindData::GetFramesSaved ( ) const
inline

◆ GetLatestFrame()

int32 Chaos::FRewindData::GetLatestFrame ( ) const
inline

◆ GetNumDirtyParticles()

int32 Chaos::FRewindData::GetNumDirtyParticles ( ) const
inline

◆ GetPastJointStateAtFrame()

FJointState Chaos::FRewindData::GetPastJointStateAtFrame ( const FPBDJointConstraintHandle Handle,
int32  Frame,
FFrameAndPhase::EParticleHistoryPhase  Phase = FFrameAndPhase::EParticleHistoryPhase::PostPushData 
) const

◆ GetPastStateAtFrame()

FGeometryParticleState Chaos::FRewindData::GetPastStateAtFrame ( const FGeometryParticleHandle Handle,
int32  Frame,
FFrameAndPhase::EParticleHistoryPhase  Phase = FFrameAndPhase::EParticleHistoryPhase::PostPushData 
) const

◆ GetResimFrame()

const int32 Chaos::FRewindData::GetResimFrame ( ) const
inline

Get and set the frame we resimulate from

◆ GetSolver()

const FPBDRigidsSolver * Chaos::FRewindData::GetSolver ( ) const
inline

Return the rewind data solver

◆ GetUseCollisionResimCache()

bool Chaos::FRewindData::GetUseCollisionResimCache ( ) const

Check if a resim cache based on IResimCacheBase (FEvolutionResimCache by default) is being used. Read FPhysicsSolverBase.SetUseCollisionResimCache() for more info.

◆ Init() [1/2]

void Chaos::FRewindData::Init ( FPBDRigidsSolver InSolver,
int32  NumFrames,
bool  InRewindDataOptimization,
int32  InCurrentFrame 
)
inline

◆ Init() [2/2]

void Chaos::FRewindData::Init ( FPBDRigidsSolver InSolver,
int32  NumFrames,
int32  InCurrentFrame 
)
inline

◆ IsFinalResim()

bool Chaos::FRewindData::IsFinalResim ( ) const
inline

◆ IsFrameWithinRewindHistory()

bool Chaos::FRewindData::IsFrameWithinRewindHistory ( int32  Frame)
inline

Check if a frame number is within the current rewind history

◆ IsResim()

bool Chaos::FRewindData::IsResim ( ) const
inline

◆ MarkDirtyFromPT()

void Chaos::FRewindData::MarkDirtyFromPT ( FGeometryParticleHandle Handle)

Call this to mark specific particle as dirty and cache its current data, expected to be called at the start of OnPreSimulate_Internal, it caches data in FFrameAndPhase::PostPushData

When using optimization, if this is the first time the joint is dirtied, cache the joints current state and register as dirty

◆ MarkDirtyJointFromPT()

void Chaos::FRewindData::MarkDirtyJointFromPT ( FPBDJointConstraintHandle Handle)

Call this to mark specific joint as dirty and cache its current data, expected to be called at the start of OnPreSimulate_Internal, it caches data in FFrameAndPhase::PostPushData

When using optimization, if this is the first time the joint is dirtied, cache the joints current state and register as dirty

◆ PushGTDirtyData()

void Chaos::FRewindData::PushGTDirtyData ( const FDirtyPropertiesManager SrcManager,
const int32  SrcDataIdx,
const FDirtyProxy Dirty,
const FShapeDirtyData ShapeDirtyData 
)

Called just before Proxy::PushToPhysicsState is called

When using optimization, if this is the first time the particle is dirtied, cache the particles current state and register as dirty

When using optimization, if this is the first time the joint is dirtied, cache the joints current state and register as dirty

◆ PushPTDirtyData()

void Chaos::FRewindData::PushPTDirtyData ( TPBDRigidParticleHandle< FReal, 3 > &  Rigid,
const int32  SrcDataIdx 
)

Called post solve but just before PQ are applied to XR

When using optimization, mark particle as dirty and then rely on FRewindData::CacheCurrentDirtyData() to cache PrePushData If this is a new entry in the dirty particles collection, cache now since CacheCurrentDirtyData for PrePushData has already happened this frame

This is called post-solve but before PQ are applied on XR If this is a kinematic moving object XR have been updated already in the integrate step via KinematicTarget and the velocity has been updated based on the XR change Get the pre-solve state of moving kinematic particles by stepping their XR back one step via their velocities.

◆ PushStateAtFrame()

void Chaos::FRewindData::PushStateAtFrame ( FGeometryParticleHandle Handle,
int32  Frame,
FFrameAndPhase::EParticleHistoryPhase  Phase,
const FVector Position,
const FQuat Quaternion,
const FVector LinVelocity,
const FVector AngVelocity,
const bool  bShouldSleep 
)

◆ RemoveInputHistory() [1/2]

void Chaos::FRewindData::RemoveInputHistory ( const TSharedPtr< FBaseRewindHistory > &  InputHistory)
inline

Remove input history from the rewind data

◆ RemoveInputHistory() [2/2]

void Chaos::FRewindData::RemoveInputHistory ( const TSharedPtr< FBaseRewindHistory > &  InputHistory,
Chaos::FGeometryParticleHandle Particle 
)
inline

Remove input history for particle from the rewind data

◆ RemoveObject() [1/4]

FORCEINLINE void Chaos::FRewindData::RemoveObject ( const FGeometryParticleHandle Particle,
const bool  bAllowShrinking 
)
inline

◆ RemoveObject() [2/4]

void Chaos::FRewindData::RemoveObject ( const FGeometryParticleHandle Particle,
const EAllowShrinking  AllowShrinking = EAllowShrinking::Default 
)
inline

◆ RemoveObject() [3/4]

FORCEINLINE void Chaos::FRewindData::RemoveObject ( const FPBDJointConstraintHandle Joint,
const bool  bAllowShrinking 
)
inline

◆ RemoveObject() [4/4]

void Chaos::FRewindData::RemoveObject ( const FPBDJointConstraintHandle Joint,
const EAllowShrinking  AllowShrinking = EAllowShrinking::Default 
)
inline

◆ RemoveStateHistory() [1/2]

void Chaos::FRewindData::RemoveStateHistory ( const TSharedPtr< FBaseRewindHistory > &  StateHistory)
inline

Remove state history from the rewind data

◆ RemoveStateHistory() [2/2]

void Chaos::FRewindData::RemoveStateHistory ( const TSharedPtr< FBaseRewindHistory > &  StateHistory,
Chaos::FGeometryParticleHandle Particle 
)
inline

Remove state history for particle from the rewind data

◆ RequestResimulation()

void Chaos::FRewindData::RequestResimulation ( int32  RequestedFrame,
Chaos::FGeometryParticleHandle Particle = nullptr 
)

Request a resimulation by setting a requested frame to rewind to

Parameters
Particlecan be used to mark a specific particle as the one triggering the resimulation

◆ RestoreHistoryState()

void Chaos::FRewindData::RestoreHistoryState ( FGeometryParticleHandle Handle,
const int32 PositionValidCount,
const int32 VelocityValidCount,
const int32 PositionNextIterator,
const int32 VelocityNextIterator 
)
inline

Restore some history information after cleaning/pushing state

◆ RewindStates()

void Chaos::FRewindData::RewindStates ( const int32  RewindFrame,
const bool  bResetSolver 
)

Rewind to state for a specified frame from rewind data

◆ SetResimFrame()

void Chaos::FRewindData::SetResimFrame ( int32  Frame)
inline

◆ SetRewindDataOptimization()

void Chaos::FRewindData::SetRewindDataOptimization ( bool  InRewindDataOptimization)
inline

Set if RewindData optimizations should be enabled or not. Effect: Only alter the minimum required properties during a resim for particles not marked for FullResim

◆ SetTargetStateAtFrame()

void Chaos::FRewindData::SetTargetStateAtFrame ( FGeometryParticleHandle Handle,
const int32  Frame,
FFrameAndPhase::EParticleHistoryPhase  Phase,
const FVector Position,
const FQuat Quaternion,
const FVector LinVelocity,
const FVector AngVelocity,
const bool  bShouldSleep 
)

◆ SpawnProxyIfNeeded()

void Chaos::FRewindData::SpawnProxyIfNeeded ( FSingleParticlePhysicsProxy Proxy)

Friends And Related Symbol Documentation

◆ FPBDRigidsSolver

friend class FPBDRigidsSolver
friend

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