using Rokid.UXR.Utility; using UnityEngine; namespace Rokid.UXR.Interaction { public class ThreeDofRayPose : BaseRayPose { private FollowCamera followCamera; private HandType handType; protected override void Start() { base.Start(); followCamera = this.GetComponent(); ThreeDofEventInput.OnPhoneRayForward += OnPhoneRayForward; // ThreeDofEventInput.Instance.ResetImuAxisY(); this.handType = ThreeDofEventInput.Instance.HandType; InitHandType(handType); } private void OnDestroy() { ThreeDofEventInput.OnPhoneRayForward -= OnPhoneRayForward; } private void OnPhoneRayForward(Vector3 forward) { if (Utils.IsUnityEditor()) return; this.transform.eulerAngles = forward; } protected override void Update() { base.Update(); if (ThreeDofEventInput.Instance.HandType != handType) { handType = ThreeDofEventInput.Instance.HandType; InitHandType(handType); } } private void InitHandType(HandType handType) { // if (Utils.IsAndroidPlatfrom()) // { // switch (handType) // { // case HandType.None: // followCamera.offsetPosition = new Vector3(0, -0.5f, 0); // break; // case HandType.LeftHand: // followCamera.offsetPosition = new Vector3(-0.1f, -0.5f, 0); // break; // case HandType.RightHand: // followCamera.offsetPosition = new Vector3(0.1f, -0.5f, 0); // break; // } // } } } }