In the past week I have been continuing my work on a script to analyze the movements of the feet in walk and run cycles. The primary new result is the analysis of foot lifting and landing times. By analysis the script finds these times for each foot:

**Lift time:** When the foot begins to lift from the ground.
**Liftoff time:** When the foot lifts off completely from the ground.
**Strike time:** When the foot first touches the ground again.
**Landing time:** When the foot has fully landed on the ground.

These times can be seen in the bottom graph in the interactive analysis visualization here. Click to activate it.

Note that the graphs refer to the ankle and toe of each foot. What they really measure is the ankle and foot positions projected onto the ground at the stance pose, i.e. points on the underside of the foot. Since these projected positions are approximately at the heel and toe, I will be referring to heel and toe positions below.

### Previous work

Automatically finding the foot lifting and landing times can be tricky, especially if the animations that are being analyzed are not of the highest quality.

In the paper

Adapting motion capture data using weighted real-time inverse kinematics by Michael Meredith and Steve Maddock, foot flight paths are extracted from motion capture data using a curve gradient analysis technique:

Our approach for retrieving the flight path from the motion capture data is based primarily on a gradient analysis technique where, over the course of the original motion, we analyze the height value of one of the character’s feet. The first target we look for is a switch from a negative to a positive gradient on a frame that is within 10% of the global minimum height for the foot. This gives us the start of the foot flight where the foot is just about to leave the ground.

From the first target, we progress along the original flight path until we meet a second gradient change from positive to negative, which is on a frame whose height value is within 10% of the global maximum. This second target is the peak of our flight height. Continuing along the original path, we locate the third and final target via one last gradient switch from negative to positive, whose frame height is again within 10% of the global minimum. This technique is demonstrated pictorially in Figure 2.

I have been inspired by this technique by Meredith and Maddock. However, in my own tests I have found their procedure insufficient to properly handle the very varied animations I have used as test cases for my system.

### Tricky animations

In my test animations, the feet don't always actually lift up from the ground when the legs starts to swing forward, but rather sort of drags along the ground. Also, the feet sometimes intersect with the ground, which also makes the analysis non-trivial.

In order to make the analysis error-tolerant in these kinds of scenarios, I have used several rules in combination to find the foot lifting and landing times.

### New rules for the analysis

The new rules are highly dependent on the

*stance time* which was described in the

previous post. The stance time is the time where the foot is standing most firmly on the ground. Starting from this, the new rules are used to find the lifting and landing times fo the feet. The same rules are applied both for finding lifting and landing times, and they are used on both the heel and toe Y movement curves (i.e. vertical movements). They are as follows:

- Start following the Y movement curve from the stance time and forward (/backwards) until the height curve reaches 10% of the maximum height of the curve. The lifting (/landing) must come before this point.
- Inside this span of the curve, find the point with the maximum curvature (the maximum second derived of the curve, i.e. the most sudden rise in the curve).
- Disregard points on the curve that are below the ground level.
- Disregard points on the curve where the first derived (i.e. the slope) is below zero (or above zero when searching backwards).

These rules combined will almost surely find the point on the curve that intuitively looks like the point where the curve starts to rise from the ground. However, another check has to be made. This check is made for the foot Z movement curve (i.e. the swinging back and forth of the foot).

- Start following the Z movement curve from the stance time and forward (/backwards) untill the slope is more than 50% different than the slope at the stance time. Since the speed at the stance time is the point of reference for the ground, a speed that deviates more than 50% must mean that the foot is no longer following the ground, and thus no longer standing on the ground. If this time occur before the lifting time (/landing time) found by the other rules, then this time is used as the lifting time (/landing time) instead.

The 50% value here has been chosen by trial and error from the test animations. For a completely accurately animated character, the feet should be moving with a completely constant speed while they are on the ground since the ground is moving backwards with a constant speed relative to the character. However, this is not always the case in actual keyframed animations, and the speeds of the feet can be quite inconsistent. Thus a large tolerance value has to be used.

### Motion synthesis next

The next step is to use the motion analysis data to synthesize adaptive walking and running animations. Using the lifting and landing times, the foot flight paths and the analyzed speed of each animation, new paths for each foot can be generated in accordance with the environment and variable movement of the character.

Read More »