Character Controller Check Has Headroom
Check whether a CharacterController has enough space above it to reach a target height.
This is useful when a crouched CharacterController should only stand up if there is enough room overhead. The action tests the standing space while keeping the feet in the same place.
Parameters
| Parameter | Description |
|---|---|
| CharacterController | The CharacterController to test. |
| Target Height | Height to test for. This is usually the standing height. |
| Layer Mask | Layers included in the headroom check. |
| Hit Triggers | Choose whether trigger colliders should be included in the query. |
| True Event | Event to send if there is enough headroom. |
| False Event | Event to send if there is not enough headroom. |
| Store Result | Store the result in a bool variable. |
Notes
- If the target height is less than or equal to the current controller height, the action returns true.
- The action uses an overlap capsule check sized for the requested target height.
- The controller itself, its own transform, and child colliders on the same character hierarchy are ignored.
- This action is commonly used to drive the
Can Standparameter in Character Controller Crouch.
Example
Use this before trying to stand:
- Set
Target Heightto the normal standing height of the CharacterController. - Store the result in a bool such as
canStand. - Feed that bool into Character Controller Crouch
Can Stand.