private void Update() { // Kill player if he falls beneath a determined height if (transform.position.y <= -30) { GameManager.instance.KillPlayer(); } // Calculate movement velocity as a 3D vector float xMovement = Input.GetAxisRaw("Horizontal"); float zMovement = Input.GetAxisRaw("Vertical"); Vector3 hMovement = transform.right * xMovement; Vector3 vMovement = transform.forward * zMovement; Vector3 velocity = (hMovement + vMovement).normalized * speed; motor.Move(velocity); // Calculate rotation as a 3D vector (turning around) float yRotation = Input.GetAxisRaw("Mouse X"); Vector3 rotation = new Vector3(0.0f, yRotation, 0.0f) * lookSensitivity; // Apply Rotation motor.Rotate(rotation); // Calculate camera rotation as a 3D vector (turning around) float xRotation = Input.GetAxisRaw("Mouse Y"); Vector3 cameraRotation = new Vector3(xRotation, 0.0f, 0.0f) * lookSensitivity; // Apply camera rotation motor.RotateCamera(cameraRotation); if (Input.GetKeyDown(KeyCode.Alpha1)) { Inventory.instance.UseItem(1); } if (Input.GetKeyDown(KeyCode.Alpha2)) { Inventory.instance.UseItem(2); } if (Input.GetKeyDown(KeyCode.Alpha3)) { Inventory.instance.UseItem(3); } if (Input.GetButtonDown("Fire1") && disk != null) { disk.TryToThrow(); } if (focusedObject != null && Input.GetKeyDown(KeyCode.P)) { if (focusedObject.CheckIfAndInteract()) { hasFocusedObject = false; } } }