void checkDrop() { if (Input.GetKeyDown(KeyCode.Mouse1)) { CS_PlayerController.dropObject(); } }
//PERFORMING CALCULATIONS void Update() { //Object Pickup & Drop if (carrying) { carry(carriedObject); checkDrop(); //rotateObject(); } else { pickup(); } //Movement & Mouse Look if (Cursor.lockState != CursorLockMode.Locked) { Cursor.lockState = CursorLockMode.Locked; } //Movement float xMov = Input.GetAxis("Horizontal"); // Between -1 and 1 float zMov = Input.GetAxis("Vertical"); // Between -1 and 1 Vector3 movHorizontal = transform.right * xMov; Vector3 movVertical = transform.forward * zMov; Vector3 _velocity = (movHorizontal + movVertical) * speed; Move(_velocity); //anim.SetFloat("zMov", zMov); //anim.SetFloat("xMov", xMov); //Mouse Look float yRot = Input.GetAxisRaw("Mouse X"); Vector3 _rotation = new Vector3(0f, yRot, 0f) * lookSensitivity; Rotate(_rotation); //Mouse Look float xRot = Input.GetAxisRaw("Mouse Y"); float _camRotationX = xRot * lookSensitivity; RotateCam(-_camRotationX); //Debug Tools REMOVE IN PLAYABLE BUILDS if (Input.GetKeyDown(KeyCode.R)) { if (carrying) { CS_PlayerController.dropObject(); } SceneManager.LoadScene("US_MechanicTest"); } }