void Update() { input = MappedInput.InputDevices[_controllerId]; Vector3 leftStick = input.GetAxis2DCircleClamp(MappedAxis.Horizontal, MappedAxis.Vertical); var fixedLeftStick = Camera.main.transform.rotation * new Vector3(leftStick.x, 0, leftStick.y); fixedLeftStick = new Vector3(fixedLeftStick.x, 0, fixedLeftStick.z); if (fixedLeftStick.magnitude > 0) { animator.SetBool("Running", true); Move(fixedLeftStick * Time.deltaTime); } else { animator.SetBool("Running", false); } Vector3 rightStick = input.GetAxis2DCircleClamp(MappedAxis.AimX, MappedAxis.AimY); var aimDir = new Vector3(rightStick.x, 0, rightStick.y).normalized; var fixedAimDir = Camera.main.transform.rotation * aimDir; fixedAimDir = new Vector3(fixedAimDir.x, 0, fixedAimDir.z); if (rightStick.magnitude != 0) { transform.rotation = Quaternion.LookRotation(fixedAimDir.normalized); } else { fixedAimDir = transform.forward; } _aimingReticle.transform.position = transform.position + fixedAimDir; if (input.GetAxis(MappedAxis.ShootGravGun) != 0 && fixedAimDir.magnitude > 0 && ShootingCooldownCoroutine == null) { ShootingCooldownCoroutine = StartCoroutine(ShootOnCooldown()); animator.SetBool("Shooting", true); } else if (input.GetAxis(MappedAxis.ShootGravGun) == 0) { animator.SetBool("Shooting", false); } if (input.GetAxis(MappedAxis.ChangeCameraAngle) != 0) { float changeCameraDir = input.GetAxis(MappedAxis.ChangeCameraAngle); CameraController.Instance.Rotate(-changeCameraDir); } }