Root motion doesn't move in the z-axis!

I created a simple jump animation for my character with one bone using Maya, two parameters are changing, the x parameter to move forward and Z parameter.

I put that animation inside an animation montage and enabled root motion options,the result isn’t as expected, what I get is a moving forward animation without any changing of Z values !

Is root motion locked into x-y axes ?or do I need manually to move up my character ?

2 Likes

I got it !

thanks to this question Why is the root motion feature not allowing my character to climb? - Character & Animation - Unreal Engine Forums
It seems that root motion translation in UE4 ignores Z movement unless the player is in flying movement mode.
I should enable flying mode and returning it back to my default mode when my montage is done.

6 Likes

This was really boggling me too! Thanks for the solution. I was even using a custom movement mode, but it does seem to have to be “flying”.

I would add to this slightly to say that, for me, UE4 seemed to ignore all translation when there was a Z component and movement mode was not flying. Rotation was applied though, regardless of movement mode.

1 Like

Hey I came up with another solution to the problem that doesn’t require changing the movement mode to flying. If you’re using C++ and a custom character movement component you can simply override the UCharacterMovementComponent::ConstrainAnimRootMotionVelocity
function. As you can see, in its implementation it is preventing the Z value from being overwritten:

FVector UCharacterMovementComponent::ConstrainAnimRootMotionVelocity(const FVector& RootMotionVelocity, const FVector& CurrentVelocity) const
{
	FVector Result = RootMotionVelocity;

	// Do not override Velocity.Z if in falling physics, we want to keep the effect of gravity.
	if (IsFalling())
	{
		Result.Z = CurrentVelocity.Z;
	}

	return Result;
}

I removed this in my override function like so and it worked great :slight_smile:

FVector UCustomCharacterMovementComponent::ConstrainAnimRootMotionVelocity(const FVector& RootMotionVelocity, const FVector& CurrentVelocity) const
{
	return RootMotionVelocity;
}
10 Likes

For those who might be interested, it’s very important to have animated in a 3D Editor not the Root Bone but the Armature itself. So, When you see in your UE5 skeletone the main Root Bone, it’s actualy not a bone but the armature itself and it has to be animated instead of the real root bone(in my case pelvis) in order to make RootMotion work.

So, RootMotion Syncs the actor not with the motion of the root bone relatively to the armature origin, but with the motion of the armature relatively to 0.0.0 coordinate of the scene in a 3D editor.