Add a walking animation with speed?

I was wondering if there was a way to add Walking to this Blend Tree to correspond with 1) how hard you press the gamepad control stick, and 2) when it toggles on/off on mouse + keyboard.

Right now, I have my Idle at 0 threshold, my Walking at 0.5 threshold, and my Running at 1 threshold. When I test my game, my character will instantly go into their running animation even though I only push the control stick slightly.

Look up Blend tree. Trust me.

My question is more about how I would fit the necessary code in the PlayerFreeLookState script. Been at it for awhile looking at other tutorials.

The value returned by the input is what you want. If I remember it correctly, we just set the float in the animator to 1f when the movement vector is not Vector3.zero. So set it to the value returned by the input instead.

Specifically, set the float value to the magnitude of the InputHandler’s movement vector.

1 Like

I’ve been trying to figure out what to replace the 1 with in the public override void Tick in FreeLookState, and still trying.

stateMachine.Animator.SetFloat(FreeLookSpeedHash, 1, AnimatorDampTime, deltaTime);

I’ve been trying things that MovementValue.Vector2, magnitude.InputReader.MovementValue, magnitude.Vector2.MovementValue, and a bunch of others.

This seems like such a simple thing to accomplish but I’m having trouble wrapping my head around it.

I use InputReader.MovementValue.magnitude in my own project.

I must be missing something because I’m getting this error message.

You’re going to laugh when you see it…

stateMachine.InputReader.MovementValue.magnitude
1 Like

Oy vey, you were right. My player can walk (WOO!) This has been bothering me forever. Will definitely remember this experience haha.

Once again, you come in with the save. Will absolutely be giving you credit in special thanks when my game comes out.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms