I got a question with a crouching script on the First Person Controller.
So I made this short code and applied it to the controller.
void Update () {
if(Input.GetKeyDown(KeyCode.C)){
transform.localScale = new Vector3 (1,0.5f,1);
}
if(Input.GetKeyUp (KeyCode.C)) {
transform.localScale = new Vector3 (1, 1, 1);
}
}
So I have it attached to the First Person Controller and when I play the inspector shows the values work accordingly. When crouched he scales down but when he comes out of crouching he scales back to normal size but just falls through the floor. As he’s falling I keep trying the crouching button to make sure the values still work and they do. The problem to me seems to be outside of the script rather than the code itself. But I could be wrong. Thanks in advance