In this recipe, we will learn how to change our character's collision while crouching. This way our character will be able to enter low areas (such as vent shafts).
We are going to use the same character as in the Using root motion to steer a character recipe with all its animations (Idle
, WalkLeft
, WalkForward
, and WalkRight
). Additionally, you should prepare those four animations in a crouch state (IdleCrouch
, WalkLeftCrouch
, WalkForwardCrouch
, and WalkRightCrouch
). We are going to use the RootMotionSteering.cs
script from the preceding mentioned recipe. You also need an obstacle in your scene. It should have a passage underneath. The passage's ceiling should be low enough so that the character cannot go through it without crouching. We don't need any other scripts to start. You can also go to the Chapter 04 Character movement\Recipe 09 Changing the characters collision while crouching
directory. You will find an Example.unity...