Character Controller Crouch
Make a CharacterController crouch by adjusting its height and center.
This action handles transitions between standing and crouching. It can work in hold mode or toggle mode, and it can optionally move direct child objects so their local Y offset scales with the controller height.
Parameters
| Parameter | Description |
|---|---|
| CharacterController | Target CharacterController. |
| Crouch Mode | Choose Hold to crouch while an input is active, or Toggle to switch crouch state with a one-frame input. |
| Is Crouching | In Hold mode, crouch while this bool is true. |
| Stand Request | In Toggle mode, use a one-frame bool pulse to request standing or crouching. |
| Crouch Height | Capsule height while crouching. The action clamps this so it never goes below twice the controller radius, and never above the original height. |
| Adjust Children | Move direct children so their local Y offset scales with the capsule height. |
| Transition Time | Time in seconds to crouch or stand. Set to 0 for an instant change. |
| Complete Transition | In Hold mode, always finish the crouch transition even if the input was only pressed briefly. |
| Can Stand | Controls whether the CharacterController is allowed to stand. This is typically driven by Character Controller Check Has Headroom. |
| Stand Event | Optional event sent when the CharacterController finishes standing. |
| Reset Height On Stop | Restore the original controller height and center if the state exits before the transition finishes. |
Notes
- The action runs every frame while the state is active.
- When crouching, the controller center is lowered so the feet stay in the same place.
- In
Togglemode,Stand Requestis required. - If
Can Standis false, the controller stays crouched even after crouch input is released. - When
Adjust Childrenis enabled, direct children are scaled from their original local Y offset and restored on stop whenReset Height On Stopis enabled.
Example
For a common setup:
- Use an input action to drive
Is Crouchingfor hold crouch, orStand Requestfor toggle crouch. - Use Character Controller Check Has Headroom to set
Can Stand. - Keep this action active in a state that updates every frame.