Generalized source of Root Motion to a CharacterMovementComponent. 更多...
#include <RootMotionSource.h>
类 FRootMotionSource 继承关系图:Public 成员函数 | |
| virtual void | CheckTimeOut () |
| Checks if this source has timed out and marks for removal if necessary | |
| virtual FRootMotionSource * | Clone () const |
| float | GetDuration () const |
| float | GetStartTime () const |
| float | GetTime () const |
| virtual bool | IsActive () const |
| True when this RootMotionSource should be affecting root motion | |
| bool | IsStartTimeValid () const |
| virtual bool | IsTimeOutEnabled () const |
| virtual bool | Matches (const FRootMotionSource *Other) const |
| virtual bool | MatchesAndHasSameState (const FRootMotionSource *Other) const |
| Checks that it Matches() and has the same state (time, track position, etc.) | |
| virtual void | PrepareRootMotion (float SimulationTime, float MovementTickTime, const ACharacter &Character, const UCharacterMovementComponent &MoveComponent) |
| Generates the RootMotion for this Source, can be used for both "live" generation or for playback (client prediction correction, simulated proxies, etc.) 更多... | |
| virtual void | SetTime (float NewTime) |
| Set the CurrentTime of this source. 更多... | |
| virtual bool | UpdateStateFrom (const FRootMotionSource *SourceToTakeStateFrom, bool bMarkForSimulatedCatchup=false) |
| 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 更多... | |
Public 属性 | |
| 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 | |
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):
Jump pad volumes that work during animation root montage attacks
Attack/melee homing
Character movement controlled by splines/curves in-editor instead of requiring animation tweaks
|
virtual |
被 FRootMotionSource_ConstantForce, FRootMotionSource_RadialForce, FRootMotionSource_MoveToForce, FRootMotionSource_MoveToDynamicForce , 以及 FRootMotionSource_JumpForce 重载.
| float FRootMotionSource::GetDuration | ( | ) | const |
| float FRootMotionSource::GetStartTime | ( | ) | const |
| float FRootMotionSource::GetTime | ( | ) | const |
| bool FRootMotionSource::IsStartTimeValid | ( | ) | const |
|
virtual |
|
virtual |
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
被 FRootMotionSource_ConstantForce, FRootMotionSource_RadialForce, FRootMotionSource_MoveToForce, FRootMotionSource_MoveToDynamicForce , 以及 FRootMotionSource_JumpForce 重载.
|
virtual |
Generates the RootMotion for this Source, can be used for both "live" generation or for playback (client prediction correction, simulated proxies, etc.)
Examples:
| SimulationTime | How far forward in time to simulate root motion |
| MovementTickTime | How much time the movement is going to take that this is being prepared for |
被 FRootMotionSource_ConstantForce, FRootMotionSource_RadialForce, FRootMotionSource_MoveToForce, FRootMotionSource_MoveToDynamicForce , 以及 FRootMotionSource_JumpForce 重载.
|
virtual |
Set the CurrentTime of this source.
Use this setter so that sources based on duration can get correctly marked for end
被 FRootMotionSource_MoveToForce , 以及 FRootMotionSource_MoveToDynamicForce 重载.
|
virtual |
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
| bMarkForSimulatedCatchup | sets the source for needing to "catch up" to current state next Prepare |
被 FRootMotionSource_ConstantForce, FRootMotionSource_RadialForce, FRootMotionSource_MoveToForce, FRootMotionSource_MoveToDynamicForce , 以及 FRootMotionSource_JumpForce 重载.
| bool FRootMotionSource::bSimulatedNeedsSmoothing |
True when this RootMotionSource is running on a SimulatedProxy and has marked itself as needing location/rotation smoothing.
This smoothing logic is what runs whenever the SimulatedProxy receives a replication update from the server (SimulatedTick in CharacterMovementComponent, see bCorrectedToServer and SmoothCorrection), this flag allows the RootMotionSource to signal to the CMC that a change was done significant enough that needs smoothing.
| uint16 FRootMotionSource::LocalID |
ID local to this client or server instance.
Used for matching up FRootMotionSources between SavedMoves and allow a mapping between server LocalIDs and client LocalIDs for correction/comparison