I’m making a first person game and I need to implement crouching. I’ve got the moving and looking down, I just need a crouch script. But I have no clue how to make it. Where do I even put it? A seperate script, the moving script, the looking script? Idk, but this is my moving script.`
public class ControllingScript : MonoBehaviour {
public float walkSpeed = 10f;
// Use this for initialization
void Start ()
{
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void Update ()
{
float translation = Input.GetAxis ("Vertical") * walkSpeed;
float straffe = Input.GetAxis ("Horizontal") * walkSpeed;
translation *= Time.deltaTime;
straffe *= Time.deltaTime;
transform.Translate(straffe, 0, translation);
if (Input.GetButtonDown("escape"))
Cursor.lockState = CursorLockMode.None;
}
`
Got any ideas?