How can i setup the CharacterMovementComponent to extract the animation movement?

how can i setup the RootMotionParams in the CharacterMovementComponent to extract the animation movement (root motion)?

At the moment root motion is supported in 2 ways.

ERootMotionMode::RootMotionFromMontagesOnly (default) This only enables root motion when a Montage with RootMotion enabled is playing. This means by default capsule physics moves the character, and when a Montage with root motion plays, it will instead drive the movement.

ERootMotionMode::RootMotionFromEverything This means that any animation in the AnimGraph can provide root motion, not just Montages. Root Motion will get blended accordingly, and only animation drives the motion.

You might want to try the second mode and see if that works well. Otherwise you can implement a custom mode.

You’ll want that function to return true:
bool USkeletalMeshComponent::IsPlayingRootMotion() const

so UCharacterMovementComponent::TickCharacterPose will ‘consume root motion’ and apply it to the physics.

I am trying to take the second path and i have setup:

CharacterMovementComponent->RootMotionParams.bHasRootMotion = true;
CharacterMovementComponent->RootMotionParams.BlendWeight = 1.0f;

AnimInstance->SetRootMotionMode(ERootMotionMode::RootMotionFromEverything);

It now uses ConsumeExtractedRootMotion(float Alpha) with Alpha is 1.0 but “FRootMotionMovementParams RootMotion = GetProxyOnGameThread().GetExtractedRootMotion()” returns RootMotion with

bHasRootMotion=false BlendWeight=0.000000000 RootMotionTransform is the Indent.

Any idea? thank you so much. A+

ExtractedRootMotion gets set in UAnimInstance::PostUpdateAnimation(). If you are overriding this, you will have to do it after that function probably.

Otherwise ExtractedRootMotion is extracted during the update phase of animation. See FAnimInstanceProxy::TickAssetPlayerInstances

if i trace in UAnimInstance::PostUpdateAnimation(), the line “FRootMotionMovementParams& ExtractedRootMotion = Proxy.GetExtractedRootMotion();” give an empty result. ExtractedRootMotion.bHasRootMotion is false;

it works now. i forgot to setup the root motion flag in the animation ;-). Thanks for the help. A+