Navigation
Unreal Engine C++ API Reference > Runtime > Engine > GameFramework
Inheritance Hierarchy
- FRootMotionSource
- FRootMotionSource_ConstantForce
- FRootMotionSource_JumpForce
- FRootMotionSource_MoveToDynamicForce
- FRootMotionSource_MoveToForce
- FRootMotionSource_RadialForce
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/RootMotionSource.h |
Include | #include "GameFramework/RootMotionSource.h" |
Syntax
struct FRootMotionSource
Remarks
Generalized source of Root Motion to a CharacterMovementComponent.
Has priorities and different accumulation modes (override, additive, set, ignore).
RootMotionSources are accumulated from highest priority to lowest, once all values are "finalized" (meaning no more accumulation to those values), root motion accumulation is finished. Having all of translation and rotation in a transform being overridden during root motion accumulation means that CharacterMovementComponent Phys*() functions no longer need to CalcVelocity() since it'll just get overridden anyway.
Some example source possibilities: Full Animation Root Motion (matching only form of root motion we've supported historically):
- Overrides all translation axes or rotation or both
- Very High priority so it gets applied first and since it is override no other RootMotionSources have an influence that are lower priority
- Scale on translation and/or rotation is set to 1 to match animation 1 for 1
- Provides local space transform (character-orientation relative)
- End result: Same as before - overrides velocity/rotation to values in AnimMontage
- But can now scale individual translation axes if desired, or instead of override can use "set" to allow other additive sources of root motion to be applied on top of the animation root motion (modify velocity to home root motion melee attacks, etc.)
Jump pad volumes that work during animation root montage attacks
- Constant velocity modification Z up, additive and high priority
- Attack/melee animation root motion uses "set" instead of "override" to allow other sources
- Animation root motion is applied, then the Z up additive of this source is so you are affected by the jump pad
Attack/melee homing
- Additive, lower priority so it gets applied after any animation/significant root motion
- World space, sourced by logic modifying velocity to go towards nearby enemies
- Could point to a UAbilityTask node from the GameplayAbilities system
Character movement controlled by splines/curves in-editor instead of requiring animation tweaks
- Same as animation root motion but source from spline/curve data
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
ERootMotionAccumulateMode | AccumulateMode | Accumulation mode for this source (whether or not to additively apply this root motion or override completely) |
![]() |
bool | bInLocalSpace | True when this RootMotionSource is contributing local space accumulation (false for world space) |
![]() |
bool | bNeedsSimulatedCatchup | True when this RootMotionSource has been marked for simulated catchup - this Simulated version of the Source needs to catch up to where it was before being corrected by authoritative version. |
![]() |
bool | bSimulatedNeedsSmoothing | True when this RootMotionSource is running on a SimulatedProxy and has marked itself as needing location/rotation smoothing. |
![]() |
float | CurrentTime | Time elapsed so far for this source |
![]() |
float | Duration | The length of this root motion - < 0 for infinite (to be removed manually) |
![]() |
FRootMotionFinishVelocitySettings | FinishVelocityParams | Finish Velocity Parameters |
![]() |
FName | InstanceName | This name allows us to find the source later so that we can end it. |
![]() |
uint16 | LocalID | ID local to this client or server instance. |
![]() |
float | PreviousTime | The last Time entry we had before the last SetTime() - used for simulated catchup |
![]() |
uint16 | Priority | Priority of this source relative to other sources - higher number being the highest priority/first applied. |
![]() |
FRootMotionMovementParams | RootMotionParams | Root Motion generated by this Source |
![]() |
FRootMotionSourceSettings | Settings | Settings of this source |
![]() |
float | StartTime | Time this source should start (in character movement client time) This is used to handle cases of inconsistent tick times (ServerMoves ticking for 1 second when root motion should have only applied for the last 0.1 seconds, or root motion source ending halfway through a 0.5 second tick) |
![]() |
FRootMotionSourceStatus | Status | Status of this source |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | AddReferencedObjects
(
FReferenceCollector& Collector |
|
![]() ![]() |
void | CheckTimeOut () |
Checks if this source has timed out and marks for removal if necessary |
![]() ![]() ![]() |
FRootMotionSource * | Clone () |
|
![]() ![]() |
float | GetDuration () |
|
![]() ![]() ![]() |
UScriptStruct * | ||
![]() ![]() |
float | GetStartTime () |
|
![]() ![]() |
float | GetTime () |
|
![]() ![]() ![]() |
bool | IsActive () |
True when this RootMotionSource should be affecting root motion |
![]() ![]() |
bool | ||
![]() ![]() ![]() |
bool | ||
![]() ![]() ![]() |
bool | Matches
(
const FRootMotionSource* Other |
For well-networked RootMotionSources, any given FRootMotionSource child class could implement their own unique ID and simply use that in the Matches check. |
![]() ![]() ![]() |
bool | MatchesAndHasSameState
(
const FRootMotionSource* Other |
Checks that it Matches() and has the same state (time, track position, etc.) |
![]() ![]() |
bool | NetSerialize
(
FArchive& Ar, |
|
![]() ![]() |
void | PrepareRootMotion
(
float SimulationTime, |
Generates the RootMotion for this Source, can be used for both "live" generation or for playback (client prediction correction, simulated proxies, etc.) |
![]() ![]() |
void | SetTime
(
float NewTime |
Set the CurrentTime of this source. |
![]() ![]() ![]() |
FString | ||
![]() ![]() |
bool | UpdateStateFrom
(
const FRootMotionSource* SourceToTakeStateFrom, |
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 |