Crouching
These two calls make the player crouch and stand up.
PlayerMovement crouch and stand up
Call Crouch() to crouch the player and StandUp() to bring them back up.
public static class PlayerMovement
{
public static bool Crouch();
public static bool StandUp();
}
| Method | Returns | What it does |
|---|---|---|
Crouch() | bool | Makes the player crouch. true when the player is crouched afterwards. |
StandUp() | bool | Makes the player stand up. true when the player stands or already stood. |
Things to know
Crouch()does nothing when the player is already crouched, and returnstrue. It does not cancel a stand that the player’s own key press left waiting. (it calls the game’sOpenSewerCharacterController.Crouch().)StandUp()makes the player stand up, if there is room. No stand stays waiting. (it calls the game’sStandUp(). The game keeps retrying the stand each frame while a ceiling is over the player. When the player is still crouched straight after the attempt, the framework calls the game’sCrouch()to cancel that retry.)- The room check is the game’s own, and the framework does not repeat it. A jump, or the short wait after a jump, also keeps the player crouched. (the test is a sphere cast in the crouched branch of
ScaleCapsuleForCrouching.) - No-clip is not here. It is a developer console command in the game, so it is left out. (
DeveloperConsoleRoutines.NoClip.)
Limits
- If something is over the player’s head, the player stays crouched and
StandUp()returnsfalse. - Both return
falsewhen no player is loaded. They also returnfalsewhen the controller is switched off, whenIsAvailableisfalse, and while a save is loading or being written.