Foot steps and blend trees

Hey, so im trying to add foot step sounds to my character, but im don’t know what the best way to go about adding this feature is.

so far my 3 ideas/things ive tried:

  1. Animation events: i haven’t yet tried animation events because ive done some research and found out that they don’t work with a blend tree so i haven’t bothered trying it.

  2. Animations curves: i was trying to use curves because they blend across animations, but im not having to much luck. sometimes the foot step sounds just dont play. the curve set up i had was a flat line with 2 spikes 1 for when the left foot hits the ground and one for the right.

  3. Raycasts: the last thing i tried was a sphere cast just beneath the foot calling foot step sounds when it hits a collider. but this isn’t working very well at all.

So i guess my question is what is the best method for foot steps? someone said in a post i found “the curves blend across the animations in the same way as any other curve, and I use zero-crossings to indicate when footfalls occur” but i didn’t know what they meant by zero-crossing.

So any help or suggestions would be great.

Thanks ~Scott

That might have been me. I set up an animation curve so it looks like a sine wave:

(Sorry, I’m not near Unity right now, so a generic picture will have to do.)

I timed the curve so it crosses that horizontal line (the y=0 axis) when one or the other of the model’s feet hits the ground.

Then I have a simple script that runs every Update. It compares the current value of the curve against the previous value. If the positive/negative sign is different, I know it crossed the y=0 axis that frame, and I play the footstep animation.

1 Like