Making your motions loop

When creating motions for crowds, it is always better when they are looping (either because they must be repeated, like walk cycles, or to be able to start them at any point in time to generate variety, like a really long ambient motion in a stadium for example).

Obviously motions generated by Motion Capture are never perfectly looping. However Golaem offers some tools to make them loop when converting them to Golaem format.

Finding the best part of the motion to create a loop

After importing the whole animation, the Crop Motion panel will display a curve showing how a given frame match with others.

The green/higher the curve, the better the frames match. You can also check the Loop match value at the left hand side of the curve to check which value is best.

Move the first frame slider to check how other frames match with the frame you select. 
Then move the last frame slider and check the values of the higher points of the curve to find the best match (the lower the value, the best match it is. 0 is a perfectly looping motion).

Note that depending on the number of frames, when you move the sliders they may move two (or more) frames by two frames. In this case you can clik in the first or last frame input field, and change values using arrow keys, to get the best possible frame.

When you found the best frames, click on the Apply button. The values in the Edit Motion panel just below are adjusted based on the selected motion part.

Making the motion loop

After cropping the motion, it is still not looping, we now needs to fix two things:

  • Orientation / Position offsets
  • Difference in animation posture of the first / last frames

Fixing offsets

The CharacterMaker displays various properties of the imported/cropped animation

  • Position Offset: difference in position between first/last frame
  • Orientation Offset: difference in orientation between first/last frame
  • Moving Direction: the direction in which the motion is heading (most of the time it corresponds to the motion Velocity except for motions like strafes)

Edit Motion Panel after motion import

In our example, we are extracting a walk cycle from a longer walking animation.

You can see that there is a big position offset on the X axis (because the character is walking forward), but also small offsets in Y/Z axis.
If you do not correct this, the character will not be walking straigt in front of him, but slowly drifting on the side and going downward (although this should be corrected by ground adaptation). So you should set Y / Z position axis to 0, to keep only the X axis difference.

Concerning the orientation offset, we want no offset at all for the character to keep going straight. So change all values to 0.

Edit Motion Panel customized to fix offsets

Here the Moving Direction is correct because the vector point in the X axis direction, but sometimes you may also need to edit it to remove the Y/Z components.


Then you need to choose when the blending between first/last frame will occur (and when the position/orientation fix will occur as well if you checked the "Fix Position/Orientation offset on blending frames only).

If you check the "Looping motion" on the CharacterMaker locator attributes, and scrub the timeline around the last selected frame, you will be able to see the difference gap between frames which needs to be fixed

Offset after the cropped part of the source motion

You can blend at any points of the motion, not only at start or end. The best moment to fix the offset is when the part which will be fixed is moving.
For example if the part which will be most modified is the Left foot, it is better to fix it while this foot is moving, not when it is supposed to be on the ground (otherwise it will be sliding).
If the difference is too big and every part of the body will be affected, then it is better to distribute the blend on the longer possible period. Just select the whole motion as blending period.
Notice that usually you want to fix the Position/Orientation offset we discussed in the previous section at the same time as the posture difference.
But if you want the Position/Orientation offset fix to be distributed along the whole motion duration, you can uncheck "Fix Position/Orientation offset on blending frames only"
Do not forget to click on the Apply button, and check the result of your looping motion
Before saving the motion, you need to compute footprints. It is really important in order to get a nice animation during simulation. You put much effort in making your motion loop, so do not forget this part! Check Setting Footprints on your Motions for more details.

Checking the result

If you are going to use this motion in a Locomotion, and even if you checked it using the Looping attribute of the CharacterMaker Locator, we recommend testing it in a simple scene with a Motion Behavior to verify everything is perfect.