How can I add footsteps?

The work to add footsteps is mostly a “Unity thing” and not a “Motion Controller thing”. That said, I’ll take you though the steps here and point out the animations that I use.

The meat of handling foot steps is adding animation events to the walk and run animations. These animation events will be picked up by your custom component and then you can do whatever you want from there. For example, you could play a sound, place a footprint on the ground, or trigger some other action.

Important: Because you’re modifying the animations, you’ll need to also modify the animator to use your new animations. To prevent Unity from replacing your changes during an update, you’ll want to make changes to a copy of the animator and a copy of the animations. Then, you’ll use these.


Animation Events

We’re just using standard Unity animation events to get notified when the animation has the foot hit the ground. That means we’re actually going to have two events; one for the left foot and one for the right foot.

We’ll start by finding the walk animations. The easiest way to do this is to just go to the copy of the animator you created, double-click on the walking sub-state-machine you’re using, and click the motion field in the walk state.

Now you know the exact animation that’s being used.

Animation Copy

Since you’re going to be modifying the animation clip in the FBX, you’ll want to create a copy of the FBX.

Ensure your copy of the animator is now using this new animation and clip in the sub-state-machine state instead of the original one. This is just a standard drag-and-drop into Unity’s motion field.

At this point, your new animator is using your new animation clip. Now we need to add the animation events.

Animation Events

If we go back to our copy of the FBX, we can select the clip we want to add animation events to.

Here we’ll position the animation timer where we want it and add an animation event for the right foot and the left. We’ll use an int of “0” to tell us the right foot is down and an int of “1” to tell us the left foot is down.

With that, our animation events are setup. Now we just need something to capture them.


Footstep Handler

For this, we need a custom MonoBehaviour. This is just a standard Unity component that has a function whose name matches that of our animation event functions above: OnFootDown.

Inside the function, we can do anything we want. In this example we’ll just write a debug statement that says our foot is down.

using UnityEngine;

namespace com.ootii.Demos
    public class FootstepHandler : MonoBehaviour
        public void OnFootDown(AnimationEvent rEvent)
            Debug.Log("Foot down: " + (rEvent.intParameter == 1 ? "left" : "right"));

Now we add the new component to our character and we get notified of footsteps.

Obviously you can get a lot more advanced and play sounds, leave footprints, etc. This just shows you the basics.



Because the Motion Controller allows you to use different movement styles, you’ll need to determine which “walk/run” motions you care about. Those will determine which animations you’ll need to copy and add animation events too.

Follow the steps above for the motions and sub-state-machines you care about and you’ll be able to find the walk and run animations to modify.


Walk Run Pivot and Basic Walk Run Pivot use:

  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_WalkFWD_v2.fbx\WalkForward
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunForward_v2.fbx\RunForward


Walk Run Strafe, Walk Run Rotate, and Basic Walk Run Strafe use:

  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_WalkFWD_v2.fbx\WalkForward
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_SWalk_v2.fbx\SWalkForwardRight
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_SWalk_v2.fbx\SWalkForwardLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_SWalk_v2.fbx\SWalkLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_SWalk_v2.fbx\SWalkRight
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_Idle2Strafe_AllAngles.fbx\WalkStrafeBackwardsLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_Idle2Strafe_AllAngles.fbx\WalkStrafeBackwardsRight
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Walking\unity_BWalk.fbx\WalkBackwards
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunForward_v2.fbx\RunForward
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeRight
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeForwardLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeForwardLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeBackwardLeft
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunStrafe.fbx\RunStrafeBackwardRight
  • Assets\ootii\MotionController\Content\Animations\Humanoid\Running\RunBackward.fbx\RunBackwards


As  you use my motion packs, create your own motions, or use your own animations you’ll need to be aware of the additional walk animations that may come into play. Again, going to the animator sub-state-machines you’re using and clicking on the walk/run state animation is the easiest way to find the animations you’ll need to add animation events to.


Page Contents