# Convert animated cycle into a treadmill state

#1

Hi all, I need some advice in getting an animated walk cycle to be converted into a treadmill-alike state such that the animation stays in one spot.

While I am able to to get it done in the other way round - animation cycle in one spot and have it animated in worldspace/ across a specified distance.

Appreciate in advance for any insights.

#2

Is the walk cycle clean, cycling and moving in a straight line?

If you sample one control (like the hips or foot) at frame `start` and then sample that same control at a future frame that is the exact same point on the cycle, then you should be able to measure the distance traveled of a single cycle.

Then move your world control backwards at that rate and bake animation as required.

#3

my character is walking in a straight line, however its hands/legs movement have varying rotational/ translational valuesâ€¦

I am still not understanding it very wellâ€¦ given from what you have mentioned, if I moved my controller backwards, that is simply in negative values?

Eg. I have a locator, where it is keyed at Frame 1 with all channels at zero values, at Frame 10, with all translational values keyed with a value of 5.

If I moved it backwards, wouldnâ€™t that be -5?

#4

Iâ€™m really unsure what you are asking.

Say you have a walk cycle, moving forward in Z, that loops every 12 frames. Assuming your IK feet and COG controllers are what are animating forward, and the root group or controller of your rig is staying at the origin.

1. Sample the translationZ of a given controller in world space on frame 0 and 36. (Or 12 or 24 or 96.)
2. The world translationZ on frame 36 minus the world translationZ on frame 0 divided by the number of cycles you measured, is the distance it has traveled.
3. If you now animate a world control moving backwards at that rate, your character should be walking in place.

Your IK feet and COG are moving forward just as they were before. But now a world control above them all is moving backwards at the opposite speed.

1. Next, to get rid of the world control moving, then you would have to bake the animation on your IK feet and COG into a new space. You tagged this post as â€ścodingâ€ť so Iâ€™m not sure what you are trying to do. But here is a hacky, brute-force way you could do it:

2. Parent constrain temporary locators to each of your controls that are moving forward in translateZ. Eg. IK feet, COG, IK hands.

3. Bake the constraint on the locators so they become animation.

4. Constrain your IK controls to the temporary locators.

5. Remove the animation from the backwards-moving world control.

6. Bake the IK controllers so their animation is now in the new space.

Maybe someone has a more straight-forward way, or there is likely an existing space-switching tool, but that is how Iâ€™d begin thinking about it.

#5

Hereâ€™s a quick and easy way I like to do this in Maya:

1. In the first frame of the clip, create a locator at the root boneâ€™s position
2. Assuming your scene is y-up and +z-forward, point constrain the root bone to the locator but only in z (the forward direction)
3. Play the animation to preview the constrained animation. It should keep the character in place, but still allow root movement sideways and up that the walk cycle may contain, but it will not move forward.
4. Bake keys down on all the joints and you should be able to safely delete the locator and see your animation walk in place.