Footsteps during Melee

ShilohGames

New member
I am not sure if this is a bug or some setting I overlooked. I am building a game where I want the character to play similar to Link in Zelda Breath of the Wild. When I do the melee attack, I want the character to stop moving and then use the melee's root motion to move the player ahead slightly. I mostly have that working right now, except I am hearing footsteps during the melee attacks. For example, if I hold 'W' during the melee attack, the footsteps continue to play even though the character is not moving.

Here is a short video showing what I am currently seeing:

Any ideas how I should debug this? Thanks.
 
I spent more time on this. I set up a new empty project, kept the original demo animations this time, and tried different character models. I am still running into this footstep glitch. Footsteps play during melee attacks. I carefully followed the Opsive tutorial videos from the YouTube channel. The Tools->Opsive->Ultimate Character Controller->Character Manager tool generates a character setup that plays footsteps during melee attacks.

I am using Unity 2021.3.13f1 with Opsive Third Person Controller version 3.0.3.

The Opsive Character Manager tool is configuring characters to use the Body Step footstep mode.

The Atlas demo character prefab does not play footsteps during melee attacks in the demo scene. But every new character that I create using the Opsive Character Manager tool does play footsteps during melee attacks.
 
I've found that the body step isn't as accurate in some situations. I recommend using the trigger mode and seeing if that helps.
 
You need to add the footstep trigger to the feet. Take a look at the demo scene for an example
 
The trigger mode is nice to have as an option for characters that we want to manually trigger each footstep effect through the animator, but I don't want to use trigger mode for everything. I would like to be able to use the body step mode most situations, since it is easier to set up.

Body step mode could easily work for this if there is a simple option to mute footsteps during a melee and/or body attack. That option would be very easy to create.

This simple option would benefit others as well. I found another thread on a similar topic:
 
I was looking through the Opsive code to see what it will take to implement a mute footsteps during melee attack option. We could put some code in CharacterFootEffects.TriggerFootStep to return false if the character is doing a melee attack or body attack.

What is the most performant way to check if the character is currently doing a melee or body attack? Is that information already exposed somewhere, or do we we to look through the character's ItemSet using itemSetManager?

If we do need to use itemSetManager.GetActiveItemSet, what groupIndex needs to be passed to that method?
 
For that scenario you could use the state system and change the footstep mode to none during the melee attack.
 
What is the most performant way to check if the character is currently doing a melee or body attack? Is that information already exposed somewhere, or do we we to look through the character's ItemSet using itemSetManager?
 
You can use the ItemSet to set the state name.

Edit: Actually, you only want to activate it during use, so you'd append the item name within the Use ability so for example it will be UseSword. We do this with aiming a lot in the demo scene.
 
Last edited:
We could put some code in CharacterFootEffects.TriggerFootStep to return false if the character is doing a melee attack or body attack. That code change is very easy. I just need to find the best way to find out if a melee or body attack is currently going. I am not interested in changing state names. I just need a performant way to find out if the character is currently doing a melee or body attack.
 
Is there somewhere in CharacterLocomotion that already exposes that information? For example, maybe we could enumerate the CharacterLocomotion.ItemAbilities. Then for each ItemAbility, check if it is Enabled and IsActive. When those are both true, then we would somehow find out if the active ability was a melee or body ability.
 
Is there some way we could get animator values from UltimateCharacterLocomotion regarding fields like on this page?

Specifically the Item ID and Movement Set ID values.
 
In the CharacterFootEffects.TriggerFootStep method, why do you compute the moving bool value? Why not simply use the existing m_CharacterLocomotion.Moving value there?
 
Using the state system is the most performant way. In my post above it gives you an example of how you can do it without any code changes. In the Sword video I give an example of disabling the CharacterIK component when the melee weapon is equipped.

If you still want to go the trigger route you will also need to subclass the Use ability so it sets the trigger value.

Why not simply use the existing m_CharacterLocomotion.Moving value there
It's a different type of moving. Character locomotion is based on input.
 
I don't understand how to do it. When I add a state in Character Foot Effects (Script) with Name MySword or Use with a preset that removes the footstep sound. It always removes the sound with MySword and with Use it removes with the sound when I shoot the rifle. The sound should only be removed when I use a melee attack
 
You can use the ItemSet to set the state name.

Edit: Actually, you only want to activate it during use, so you'd append the item name within the Use ability so for example it will be UseSword. We do this with aiming a lot in the demo scene.
I'm sorry the answer had already been given. Just to complete, just check Append Item in Ultimate Character Locomotion (Script) ->Abilities ->Use.
And in Character Foot Effects (Script) -> States -> create a new preset wiht Name UseMySword
 
Top