playMaker

Author Topic: Any specific setup required for "Get Animator X Foot Bottom Height"?  (Read 300 times)

TonyCooper

  • Playmaker Newbie
  • *
  • Posts: 6
Hello,

I'm wanting to add footstep sounds to a blend tree set of walk/run animations and want to use the "Get Animator Left/Right Foor Bottom Height" actions to check when the foot is approaching its lowest point to then play a sound.

The issue is the value I get is always the same.

FYI I have 'Every Frame' checked, and I have looked at the walk/run animation clips individually and the Y value of the foot is changing in there.

So I was thinking there is some specific setup for this I am missing? Maybe the foot/bone needs a specific name so that the action picks it up correctly? Or something in the blend tree setup?

Any help greatly appreciated!
Tony.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Any specific setup required for "Get Animator X Foot Bottom Height"?
« Reply #1 on: March 25, 2023, 04:33:42 AM »
Hi.
maybe you can use a animation event :

place a fsm on the object with the animator.
if you have more than 1 fsm on that object, make sure its on the top (as it will use the 1st fsm it sees)

add a event to your animation on the spot where the foot is lowest.

select the event and on the inspector, select "Set State" or "Send Event"

then place the 'State Name' or transition event name

set state seems to work faster than send event, but both should work.

in the state, do the sound or whatever you need.

TonyCooper

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Any specific setup required for "Get Animator X Foot Bottom Height"?
« Reply #2 on: March 25, 2023, 11:41:57 AM »
Thanks for the help - that was the original way I was trying and failing to achieve it, but thanks to your info and a forum-hunt I managed to solve the issue.

Basically I had added animation events (writing SendEvent(event) in the Function text box) to the animation in the project window then 'Apply'd them, but that didn't work. And in the Animation window, the animation was always marked (Read Only) so I couldn't edit it in there.

But it turned out there is a method to allow editing imported animations in the Animation window, and that then 'unlocked' the 'Function' drop-down in the inspector when selecting the animation event and I then followed your info and have it working now!

Thanks again,
Tony.

FYI the info on removing (Read Only) from imported animations was found here: https://forum.unity.com/threads/removing-read-only-from-animation-clips.514549/ - I then just dropped the duplicated animation into the blend tree and that allowed me to edit it in the Animation window :)