private IEnumerator InteractWithDoorHandle() { Vector3 playerRelativePosition = playerRelativePositionChecker.transform.InverseTransformPoint(player.transform.position); PlayerInteractingWithDoor = true; playerCameraRotation.DisableRotation(); AimDotUI.Instance.DisableAimDot(); while (inputDelegate(defaultKeyToInteract)) { float desiredMouseInput = Mathf.Abs(Input.GetAxisRaw("Mouse X")) > Mathf.Abs(Input.GetAxisRaw("Mouse Y")) ? Input.GetAxisRaw("Mouse X") : Input.GetAxisRaw("Mouse Y"); //Choose input based on which left / right input is bigger. doorRigidbody.AddRelativeTorque(doorGameObject.transform.up * rotationSpeed * (desiredMouseInput = playerRelativePosition.z > 0 ? desiredMouseInput : -desiredMouseInput) * Time.deltaTime, ForceMode.VelocityChange); yield return(null); } PlayerStoppedInteraction(); }
private void EnterRotationState() { IsBeingRotated = true; playerCameraRotation.DisableRotation(); rigidbody.freezeRotation = false; }