UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FRootMotionSource_ConstantForce Struct Reference

#include <RootMotionSource.h>

+ Inheritance diagram for FRootMotionSource_ConstantForce:

Public Member Functions

ENGINE_API FRootMotionSource_ConstantForce ()
 
virtual ~FRootMotionSource_ConstantForce ()
 
virtual ENGINE_API FRootMotionSourceClone () const override
 
virtual ENGINE_API bool Matches (const FRootMotionSource *Other) const override
 
virtual ENGINE_API bool MatchesAndHasSameState (const FRootMotionSource *Other) const override
 
virtual ENGINE_API bool UpdateStateFrom (const FRootMotionSource *SourceToTakeStateFrom, bool bMarkForSimulatedCatchup=false) override
 
virtual ENGINE_API void PrepareRootMotion (float SimulationTime, float MovementTickTime, const ACharacter &Character, const UCharacterMovementComponent &MoveComponent) override
 
virtual ENGINE_API bool NetSerialize (FArchive &Ar, UPackageMap *Map, bool &bOutSuccess) override
 
virtual ENGINE_API UScriptStructGetScriptStruct () const override
 
virtual ENGINE_API FString ToSimpleString () const override
 
virtual ENGINE_API void AddReferencedObjects (class FReferenceCollector &Collector) override
 
- Public Member Functions inherited from FRootMotionSource
ENGINE_API FRootMotionSource ()
 
virtual ~FRootMotionSource ()
 
ENGINE_API float GetTime () const
 
ENGINE_API float GetStartTime () const
 
ENGINE_API bool IsStartTimeValid () const
 
ENGINE_API float GetDuration () const
 
virtual ENGINE_API bool IsTimeOutEnabled () const
 
virtual ENGINE_API bool IsActive () const
 
virtual ENGINE_API void SetTime (float NewTime)
 
virtual ENGINE_API void CheckTimeOut ()
 

Public Attributes

FVector Force
 
TObjectPtr< UCurveFloatStrengthOverTime
 
- Public Attributes inherited from FRootMotionSource
uint16 Priority
 
uint16 LocalID
 
FName InstanceName
 
float StartTime
 
float CurrentTime
 
float PreviousTime
 
float Duration
 
FRootMotionSourceStatus Status
 
FRootMotionSourceSettings Settings
 
ERootMotionAccumulateMode AccumulateMode
 
bool bInLocalSpace
 
bool bNeedsSimulatedCatchup
 
bool bSimulatedNeedsSmoothing
 
FRootMotionMovementParams RootMotionParams
 
FRootMotionFinishVelocitySettings FinishVelocityParams
 

Detailed Description

ConstantForce applies a fixed force to the target

Constructor & Destructor Documentation

◆ FRootMotionSource_ConstantForce()

FRootMotionSource_ConstantForce::FRootMotionSource_ConstantForce ( )

◆ ~FRootMotionSource_ConstantForce()

virtual FRootMotionSource_ConstantForce::~FRootMotionSource_ConstantForce ( )
inlinevirtual

Member Function Documentation

◆ AddReferencedObjects()

void FRootMotionSource_ConstantForce::AddReferencedObjects ( class FReferenceCollector Collector)
overridevirtual

Reimplemented from FRootMotionSource.

◆ Clone()

FRootMotionSource * FRootMotionSource_ConstantForce::Clone ( ) const
overridevirtual
Returns
newly allocated copy of this FRootMotionSource. Must be overridden by child classes.

Reimplemented from FRootMotionSource.

◆ GetScriptStruct()

UScriptStruct * FRootMotionSource_ConstantForce::GetScriptStruct ( ) const
overridevirtual

Reimplemented from FRootMotionSource.

◆ Matches()

bool FRootMotionSource_ConstantForce::Matches ( const FRootMotionSource Other) const
overridevirtual
Returns
Whether this is the same RootMotionSource as Other. This is used for networking when clients receive RootMotionSource data from the server and need to decide which local RootMotionSource to compare and apply the corrections to. This is required due to RootMotionSources in general being added independently on server and clients, not needing to know about each other by default.

For well-networked RootMotionSources, any given FRootMotionSource child class could implement their own unique ID and simply use that in the Matches check. This "heuristic-style" default was chosen to simplify addition of new RootMotionSources, and assumes that in a networked setting a given RootMotionSource won't be applied many times in a given frame by the same instigator to the same target with the exact same parameters.

Guaranteed uniqueness would also require a strict application order ("RootMotionSources can only be added on Authority") or a prediction-based setup ("Apply on Autonomous and Simulated predictively, then apply on Authority and confirm, and if Authority doesn't confirm remove them"). We avoid that synchronization complexity for now.

See UCharacterMovementComponent::ConvertRootMotionServerIDsToLocalIDs

Should be overridden by child classes, as default implementation only contains basic equivalency checks

Reimplemented from FRootMotionSource.

◆ MatchesAndHasSameState()

bool FRootMotionSource_ConstantForce::MatchesAndHasSameState ( const FRootMotionSource Other) const
overridevirtual

Checks that it Matches() and has the same state (time, track position, etc.)

Reimplemented from FRootMotionSource.

◆ NetSerialize()

bool FRootMotionSource_ConstantForce::NetSerialize ( FArchive Ar,
UPackageMap Map,
bool bOutSuccess 
)
overridevirtual

Reimplemented from FRootMotionSource.

◆ PrepareRootMotion()

void FRootMotionSource_ConstantForce::PrepareRootMotion ( float  SimulationTime,
float  MovementTickTime,
const ACharacter Character,
const UCharacterMovementComponent MoveComponent 
)
overridevirtual

Generates the RootMotion for this Source, can be used for both "live" generation or for playback (client prediction correction, simulated proxies, etc.)

Examples:

  • Animation RootMotionSources use Time as track time into AnimMontage and extract the root motion from AnimMontage chunk of time (Position,Position+DeltaTime)
  • ConstantForce source uses Time as the time into the application so if its duration ends halfway through the frame it knows how much root motion it should have applied
  • Spline/curve-based sources use Time for knowing where on spline/curve to extract from
    Parameters
    SimulationTimeHow far forward in time to simulate root motion
    MovementTickTimeHow much time the movement is going to take that this is being prepared for

Reimplemented from FRootMotionSource.

◆ ToSimpleString()

FString FRootMotionSource_ConstantForce::ToSimpleString ( ) const
overridevirtual

Reimplemented from FRootMotionSource.

◆ UpdateStateFrom()

bool FRootMotionSource_ConstantForce::UpdateStateFrom ( const FRootMotionSource SourceToTakeStateFrom,
bool  bMarkForSimulatedCatchup = false 
)
overridevirtual

Mainly for server correction purposes - update this Source's state from another's, usually the authoritative state from the server's version of the Source

Parameters
bMarkForSimulatedCatchupsets the source for needing to "catch up" to current state next Prepare
Returns
Whether the update was sucessful or not. Note that failure to update denotes a complete failure, and the Source will then be marked for removal. We need to remove since we don't have a way of reverting partial updates depending on where the update failed.

Reimplemented from FRootMotionSource.

Member Data Documentation

◆ Force

FVector FRootMotionSource_ConstantForce::Force

◆ StrengthOverTime

TObjectPtr<UCurveFloat> FRootMotionSource_ConstantForce::StrengthOverTime

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