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

#include <RootMotionSource.h>

+ Inheritance diagram for FRootMotionSource_MoveToForce:

Public Member Functions

ENGINE_API FRootMotionSource_MoveToForce ()
 
virtual ~FRootMotionSource_MoveToForce ()
 
ENGINE_API FVector GetPathOffsetInWorldSpace (const float MoveFraction) const
 
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 SetTime (float NewTime) 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 CheckTimeOut ()
 

Public Attributes

FVector StartLocation
 
FVector TargetLocation
 
bool bRestrictSpeedToExpected
 
TObjectPtr< UCurveVectorPathOffsetCurve
 
- 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

MoveToForce moves the target to a given fixed location in world space over the duration

Constructor & Destructor Documentation

◆ FRootMotionSource_MoveToForce()

FRootMotionSource_MoveToForce::FRootMotionSource_MoveToForce ( )

◆ ~FRootMotionSource_MoveToForce()

virtual FRootMotionSource_MoveToForce::~FRootMotionSource_MoveToForce ( )
inlinevirtual

Member Function Documentation

◆ AddReferencedObjects()

void FRootMotionSource_MoveToForce::AddReferencedObjects ( class FReferenceCollector Collector)
overridevirtual

Reimplemented from FRootMotionSource.

◆ Clone()

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

Reimplemented from FRootMotionSource.

◆ GetPathOffsetInWorldSpace()

FVector FRootMotionSource_MoveToForce::GetPathOffsetInWorldSpace ( const float  MoveFraction) const

◆ GetScriptStruct()

UScriptStruct * FRootMotionSource_MoveToForce::GetScriptStruct ( ) const
overridevirtual

Reimplemented from FRootMotionSource.

◆ Matches()

bool FRootMotionSource_MoveToForce::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_MoveToForce::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_MoveToForce::NetSerialize ( FArchive Ar,
UPackageMap Map,
bool bOutSuccess 
)
overridevirtual

Reimplemented from FRootMotionSource.

◆ PrepareRootMotion()

void FRootMotionSource_MoveToForce::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.

◆ SetTime()

void FRootMotionSource_MoveToForce::SetTime ( float  NewTime)
overridevirtual

Set the CurrentTime of this source. Use this setter so that sources based on duration can get correctly marked for end

Reimplemented from FRootMotionSource.

◆ ToSimpleString()

FString FRootMotionSource_MoveToForce::ToSimpleString ( ) const
overridevirtual

Reimplemented from FRootMotionSource.

◆ UpdateStateFrom()

bool FRootMotionSource_MoveToForce::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

◆ bRestrictSpeedToExpected

bool FRootMotionSource_MoveToForce::bRestrictSpeedToExpected

◆ PathOffsetCurve

TObjectPtr<UCurveVector> FRootMotionSource_MoveToForce::PathOffsetCurve

◆ StartLocation

FVector FRootMotionSource_MoveToForce::StartLocation

◆ TargetLocation

FVector FRootMotionSource_MoveToForce::TargetLocation

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