void Update() { //rotate player around mouse float distance; ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (plane.Raycast(ray, out distance)) { Vector3 target = ray.GetPoint(distance); Vector3 direction = target - transform.position; float rotation = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg; transform.rotation = Quaternion.Euler(0, rotation, 0); } //Player Movement float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); float x = transform.position.x + moveHorizontal * movementSpeed * Time.deltaTime; float z = transform.position.z + moveVertical * movementSpeed * Time.deltaTime; transform.position = new Vector3(x, transform.position.y, z); //Player actions if (Input.GetMouseButtonDown(0) && bulletScript.CanStartAbility()) { bulletScript.Shoot(); } if (Input.GetKeyDown(KeyCode.LeftShift) && dash.CanStartAbility()) { dash.StartAbility(); } if (dash.abilityOn) { dash.UpdateMovement(); } }