Inconsistent footsteps when attacking when Force Root Motion Position is true

badical

New member
UCC v2.4.5
Unity 2021.2.8f1

Problem: Inconsistent footstep audio
Footsteps will play when attacking with Force Root Motion Position to true while providing movement input (even though it's effectively ignored).
Footsteps will not play if there is no movement input being applied, though.

This is reproducible in the demo with the following steps:
  1. Load the demo
  2. Select 3rd Person
  3. Start punching without holding any movement keys. There are no footsteps (expected)
  4. Start punching while holding movement keys. The character doesn't move, but there are now footsteps being played (unexpected).
This also impacts swords. I did not test ranged weapons.

I think this is due to the Moving property in UltimateCharacterLocomotion.cs (line 258) returning true if m_InputVector.sqrMagnitude > 0.001f;. This will always return true if input is being provided, regardless of the root motion setting.

I'm not strongly opinionated on whether the footsteps should happen or not during root motion (although it can be audibly busy with footsteps and weapon sounds at the same time...). It's just inconsistent based on whether input is being applied or not.

Edit: This probably belongs in General Discussion since it's not really a question. Unless, I ended it with "Is this expected behavior?" :D
 
Last edited:
Thanks for the report - I was able to reproduce it. Moving needs to be true when there is input for the animator to work correctly, but it looks like you're right in terms of the cause. I'll apply a fix specific to Character Footsteps and let you know after I do.

Edit: I fixed this. The biggest change that I made was adjusting the FootstepTrigger to have a z value of 0. This prevented the trigger from intersecting so many objects. I also changed the top of CharacterFootEffects.TriggerFootStep to:

Code:
            var moving = m_CharacterLocomotion.LocalLocomotionVelocity.sqrMagnitude > 0.01f;
            if (!moving && m_RequireMovement) {
                return false;
            }

            // Don't place a footstep if:
            // - The character isn't moving but is required to move.
            // - There was recently a footstep.
            if ((!moving && m_RequireMovement) || m_LastFootstepTime + m_MinTriggerInterval > Time.time) {
                return false;
            }
 
Last edited:
Thanks for the quick reply, Justin.

RE:
The biggest change that I made was adjusting the FootstepTrigger to have a z value of 0
I'm not certain which attribute you are talking about. The Foot Offset on Character Foot Effects?
EDIT: I now realize you mean the Transform.z value on the FootstepTrigger object on the rig ?‍♂️ Which is exactly what you said, but my brain tried to make it more complicated.

Regardless, I confirmed the code change does make the footsteps consistently happen with or without movement input when using Footstep Mode: Trigger.

I was originally using Footstep Mode: Body Step, which still has this problem. But I have changed to Trigger as it's probably better anyway.
 
Last edited:
Top