Combining "Animation Root Motion" with other "Root Motion Sources"


I’ve recently been reading through some of the Engine code regarding RootMotionSources and CharacterMovementComponents.

However I have found some code (and comments) in each that seems to be quite contracdictory, in particular relating to combining classic “Animation Root Motion” with the more generic “Root Motion Sources”.

Example 1:

In the lengthy comment in RootMotionSource.h that gives an example of how RootMotionSources could be used to implement a Jump Pad that does not interrupt root motion animations, it says:

* - Animation root motion is applied, then the Z up additive of this source is so you are
*   affected by the jump pad

Whereas in UCharacterMovementComponent::PerformMovement() there is the following comment:

// Animation root motion overrides Velocity and currently doesn't allow any other root motion sources

The first comment implies Anim Root Motion can be combined with other Root Motion Sources, whereas the second quite explicitly says they cannot.

Example 2:

Back in the RootMotionSources comment it also says the following:

* Generalized source of Root Motion to a CharacterMovementComponent.
* Has priorities and different accumulation modes (override, additive, set, ignore).

However the actual AccumulationModes enum in the same file only has the following elements:

enum class ERootMotionAccumulateMode : uint8
  // Sets velocity to this value directly
  Override = 0,
  // Gets added on top of existing velocity
  Additive = 1

(In other words, while the comment says there are “set” and “ignore” accumulation modes available, they don’t actually seem to exist in the code.)

So I was just wondering whether anyone knew why this discrepency exists? Is it the intention that RootMotionSources will eventually be able to be used in combination with Animation Root Motion? Or maybe it was once supported but no longer is? (And similarly, what has happened to those extra accumulation modes?)

And perhaps more importantly, is there a way I could go about combining them in some custom way? I’ve been wondering whether a good approach would be to implement my own FRootMotionSource struct that internally extracts and applies the root motion information from the animation, and then as it’s all housed within an FRootMotionSource it will hopefully be able to combine with other FRootMotionSources? (Although I suspect I may also need to suppress the CharacterMovementComponent’s default handling of the animation root motion in that case…)

Does this sound like it’d be *at all *sensible…?

Any thoughts would be appreciated.

Thanks in advance,

I also noticed this issue, so I ended up using RootMotionSource to extract rootmotion from montage, and disable AnimMontage’s rootmotion. thus I can get root motion transform from animation root motion as well as other rootmotion sources.