ive made this simple code to regulate the height of the player once Lcontrol is pressed
//crouching
if (Input.GetKey(KeyCode.LeftControl))
controller.height = 1.0f;
else
controller.height = 2.0f;
but my charachter gets stuck if there is a roof over his head while crouchin
- how do i make a function that detects if there is something above my head so even if i unpress the Lcontroll button my caracter stays crouched
- how do i lower the camera/body automatically because the camera rn gets stuck in the roof ( with the stuck player )
and you know generally be a smooth crouch ^^" , thanks in advance !