Set up a Root Motion character for Unreal with correct Root rotations & translations in MotionBuilder

The root motion problem – this is what you want -New animations are rotated and aligned with the last frame of the previous animation. So starting at 1. we see the character from the top. The anim moves her along the blue path. When the anim loops at 2.  the loop begins again from the correct position at the last frame of the preceeding animation, not jumping back to 1.

This is the method to set up a character in Mobu with a root and to get motion onto the root to use in Unreal.

I’m assuming that you know something about MotionBuilder and how to set up characters and retarget motion. (For the purpose of this guide ‘BRUNOTPOSE’ is my example character in Mobu & Unreal. I’m also going to assume that you have some familiarity with Unreal and can create animation blueprints and so on.)


1. The character mesh and skeleton must be in a Tpose facing the Y direction at 0,0.

2. The character to be characterised needs a Skeleton Root as the top parent, renamed to Root. If its doesn’t have one yet, drag one out from the Asset Browser/Templates/Elements .

3. Open the Root Properties and make sure it has the following settings:

Enable Translation DOF = Ticked
ENABLE MinY
= Ticked
ENABLE MaxY
= Ticked

Enable Rotation DOF = Ticked
Rotation Order =
Euler XYZ
Pre Rotation X =
-90
Enable Min X  =
Ticked
Enable Min Y =
Ticked
Enable Max X =
Ticked
Enable Max Y =
Ticked
Also these 2 settings may be handy for visually checking the root rotation in Mobu.
Show DOF icon
DOF Icon size = 99

All this allows the root to rotate in Y and translate over the groundplane but not move up or down.

Skeleton Root Properties

4. In the schematic parent the Pelvis bone to the root.

Root is the top parent. No need for the Root to be a Special Hips Translation in the character definition. In fact Root does not need to be in the character definition at all.

Note also that the character does not need a Reference or Null at the top of the hierarchy.

5. To the Root add a Rotation & a Position Constraint setting Root to be the constrained object and setting Pelvis to be the Source. Click Active in each constraint to unsurprisingly activate it. The constraints will move the root around with the Pelvis.

Root with a rotational constraint

6. Drag a Character from the Asset Browser onto the Hips /Pelvis node. It may complain if your bones don’t have standard naming – for example, Pelvis instead of Hips. In that case open the Actor Character Controls, select <YourCharacter> from the character drop down and if there are any missing bones you will see something like this image. In my case I need to fix the hips, so double click the white hip slot on the diagram, then select the corresponding bone in the schematic window. 

Missing Hips

When a bones is in a character slots, it will turn green. (I’m ignoring the orange warnings as my bones aren’t totally flat. )

6. Now you can select the <YourCharacter> in the Navigator & under Character Definition select Characterise.


(Note: under my Character Settings I am using Match Source –  my character is the same size as the performer.)

7. Save this Character and import it as a Skeletal Mesh into Unreal.


Now for getting the motion.

How I do normally is deal with my mocaps is by having a T-pose for my performer and making a bunch of separate files for each take. Typically all the mocap from one performer in one session. I characterise the T-pose (in my case called HarryMotionCharacter) so I can use it to drive the BRUNOTPOSE character and then I can drop each motion take onto the HarryMotionCharacter and choose ‘Replace Animation’

Lets do it:

1. merge in a characterised T-pose character.
 
2. From the Asset browser drag one of Harrys motion takes onto Harry’s root choosing ‘Replace Animation’.

3. In Character Settings choose BRUNOTPOSE character and set the input to Character and the Input source to HarryMotionCharacter. Now BRUNOTPOSE should move around with Harrys motion.

4. The important bit. In the Schematic window (CTRL+W) select all of BRUNOTPOSE Bones & Root and from the top Animation Menu choose ‘Plot Selected All properties’ (other types of plotting or choosing Plot from outer places doesn’t work – the root doesn’t get the rotations – for example in the Character Settings the Plot Character button won’t plot everything – this foxed me for ages.)

This is the dialogue box that pops up when you choose ‘Plot Selected All properties’ I just left the settings as is.

5. With the Bones and Root still selected choose File/MotionFileExport. (Check which channel is being exported for me the motion always seems to be plotted to TAKE001 with the original motion in the other take. So you need to Export TAKE001)

6. Now we must zero the motion file so that the first frame of the animation sees the root positioned at 0,0 with the skeleton is facing Y. Open up your exported motion file. Select the root, make sure the timeline is at the first frame of animation. Open the fCurves window and select Translation X, Y and Z, drag over the the 3 curves to select them, then with translation tool selected type in 0,0,0 for the Translation in the bottom of the 3d View window. Now hit Move Keys in the Key Control window to make it stick.

Setting the animation to start at o,o

7. Repeat the process but this time in the fCurves window select Rotation X, Y and Z, get the Rotation tool and set rotation Y to 0 or -180 –  whatever rotation it needs to be facing Y. (The X and Z may be 90 or 180 that fine, we are not using concerned with those rotations.) Now hit Move Keys in the Key Control window to make it stick.

8. Save the animation and go over to Unreal.


In Unreal

You already imported the skeletal mesh – in my case BRUNOTPOSE

1. Now import the animation, I select BRUNOTPOSE as the Skeletal Mesh in the import dialogue.
Open the anim, select Enable Root Motion, (now the animation will be literally rooted to the spot, then Save.

Enabling Root Motion counterintuitively stops the thing moving… : (

2. In the Unreal Content Browser Rclick and create an Blueprint/Animation– open the blueprint, under Class Defaults choose ‘Root motion from Everything’ and hook up your animation. (More info here) Save.

Root Motion from Everything

3. In Content browser create a Blueprint Class/Character. Set it to use your Skeletal Mesh (in my case BRUNOTPOSE) & YourAnimationBlueprint (in my case BrunoAnimBP). This will give you a character which can be an NPC – which is what I want. It will have a Capsule collider which will collide with walls and other characters. You can drop it in the world and when you press Play (Simulate) the root motion will move the character around when the blueprint animation loops or plays a new animation it will start in the correct position.


This guide was helped out by support from our friends over at Target3D and EPIC’s Unreal Developer Network and Crispin Broadhurst from Mocap Online and Motus Digital.