when i crouch, its almost like i am teleporting to a lower level. any ideas on how to slow it down? (i am new to unity)
public class crouch : MonoBehaviour
{
public CharacterController CT;
public float activeCrouch = 1f;
public float notCrouch = 3f;
public GameObject player;
// Start is called before the first frame update
void Start()
{
CT = gameObject.GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.LeftShift))
{
CT.height = activeCrouch;
player.transform.localScale = new Vector3(1f, 1f, 1f);
}
else
{
CT.height = notCrouch;
player.transform.localScale = new Vector3(1f, 2f, 1f);
}
}
}