play a foot sound, when the character moves, in each animation (walking, running, aiming) the moment the left foot touches the ground and the moment the right foot touches the ground
As shown in the image below, we played the footstep sound using the method call key frame
Walking, running, and aiming walking were handled using an animation tree, and the transitions between each animation used a state machine within the animation tree.
When switching between states, the time is set to 0.2 seconds on xfade, and the curve is set to an upward-right straight line
When i do this, the footsteps play well, but it’s also played in blending between animations, the method call keyframe of each animation works
Sound is just playing at the same time.
Is there a way to block the call of a keyframe event on the other side when the animation is blending or to detect if the animation is currently blending?
I’m late to the party, but I had a similar problem and found this forum post. I fixed this issue by using an if statement in the function that gets triggered by the animation:
Returns the currently playing animation state. Note: When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
This means that when the AnimationState starts blending, the GetCurrentNode() already returns the new state.
I’m using C# for my project, but it should be similar in GDscript.