Check out example codes for "how to crouch in unity". It will help you in understanding the concepts better.

Code Example 1

///requires character controller to be on player
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
	public CharacterController rb;
    
void Start() {
	rb = GetComponent<Rigidbody>();
}
void Update() {
 	if(Input.GetKey(KeyCode.C)) {
    	controller.height = 1f;
            isCrouching = true;
            speed = crouchWalk;
        }
        else
        {
            controller.height = 2f;
            isCrouching = false;
            speed = walkSpeed;
        }
    }
}

Learn ReactJs, React Native from akashmittal.com