How to do it...

To change the size of a collider while crouching, follow these steps:

  1. Import the character with Idle, WalkLeft, WalkForward, WalkRight, IdleCrouch, WalkLeftCrouch, WalkForwardCrouch, and WalkRightCrouch animations.
  2. Create a new Animator Controller.
  3. Right-click on the empty space of the controller and choose Create State | New From Blend Tree. We need two such states. Name one of them Idle and the second one Steering.
  4. Create three float parameters in the controller: Speed, Direction, and Crouch.
  1. Create two transitions:
    • Idle | Steering with one condition: Speed parameter value greater than 0.5. Has Exit Time should be set to false and Transition Duration set to around 0.2 seconds.
    • Steering | Idle with one condition: Speed ...

Get Unity 5.x Animation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.