Why are we converting the Input Values to just 0 or 1? The blend tree takes care of all the animation blending from the “raw” input values - if we add a new state between “Idle > Running” in the blend tree, don’t we need to add more IF statements in the code to make that functionality work?
Ex: I’ve added a Walking animation in the blend tree, so it’s Idle > Walking > Running (0>0.5>1). I’ve just added these two lines of code in the Update Animator Method, and it works flawlessly on both keyboard and Gamepad
Here is a screen recording of what I’m talking about: the movement is from Keyboard in the first part / Gamepad is in the second. By using the raw input values from the gamepad we can trigger the walking blend state. If we hardcode the value to be 1f there’s no way to add more states without adding more IF statements.
Am I missing something? In the Argon Assault Course, we just read and use the input values to drive the animations/movement, why convert them to absolute values here? Here is what I’m using in the video to drive the animator.
private void UpdateAnimator(float deltaTime)
{
stateMachine.Animator.SetFloat(_targetingForwardHash,stateMachine.InputReader.MovementValue.y,AnimatorDampTime,deltaTime);
stateMachine.Animator.SetFloat(_targetingRightHash,stateMachine.InputReader.MovementValue.x,AnimatorDampTime,deltaTime);
}