How to crouch

One way to do a crouch is to create a layer called crouch and an avatar named crouch.

We can exclude the legs and ik, the rest stays on and we can test the character crouching and then when moving, it retains the step placement as well. It looks like crap. There are other ways to do this though that give better results.

In the mask area, turn on the sync. This creates what looks like the same animations as the base layer. We can replace this base with the weighted crouch layer to go from standing to crouch. We need to get the appropriate animations and values for the idle blendtree.

Pull out the avatar mask. In the blendtree, we are going to turn on the sync button.

It looks like we duplicated the blend tree from the base layer — which we did, but now we’re going to replace the animations. Double click the fighting idle and let’s swap them out for the crouching animations. Set the parameters the same as well.

We have the crouching animation working. Now let’s make it work whenever we press the C button.

To do this, we need to create the button on the input system.

In the starter assets inputs script, let’s add crouch.

In the FPC, send the crouching function a modulus check to see if the int is even. If it is, crouching is true, if not, crouching is false.

Let’s add a crouching weight to custom controls.

Finally, let’s add the crouching function for the custom controls to either crouch or not.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Al Heck

Unity Developer and Software Engineer who loves making games with GameDevHQ