using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Crouch : MonoBehaviour
{
CapsuleCollider playerCol;
float originalHeight;
public float reducedHeight;
// Start is called before the first frame update
void Start()
{
playerCol=GetComponent();
originalHeight = playerCol.height;
}
// Update is called once per frame
void Update()
{
if(Input.GetButtonDown(KeyCode.LeftControl))
Crouch2();
else if(Input.GetButtonUp(KeyCode.LeftControl))
GoUp();
}
void Crouch2()
{
playerCol.height=reducedHeight;
}
void GoUp()
{
playerCol.height=originalHeight;
}
}