private void updateInputs() { Camera camera = Camera.main; float xAxis = Input.GetAxis("Horizontal"); float zAxis = Input.GetAxis("Vertical"); Vector3 aim = new Vector3(xAxis, 0, zAxis); Vector3 direction = new Vector3((xAxis * walkSpeed), 0, (zAxis * walkSpeed)); if (Input.GetButton("Vertical") || Input.GetButton("Horizontal")) { if (canSpin) { //Spins character to look where they're aiming if (aim != Vector3.zero) { float step = spinSpeed * Time.deltaTime; Vector3 newDirection = Vector3.RotateTowards(transform.forward, aim, step, 0.0f); transform.rotation = Quaternion.LookRotation(newDirection); } } if (canMove && isGrounded) { //rb.AddForce(direction, ForceMode.VelocityChange); _RB.velocity = direction; //rb.velocity = (transform.forward * walkSpeed) * zAxis; } } if (Input.GetButton("Jump")) { if (isGrounded) { jump(); } } if (Mathf.Abs(transform.position.y) > 100) { Debug.Log("Fall out"); if (global != null) { global.GameOver(); } } }