1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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<FollowCamera>();
- 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;
- // }
- // }
- }
- }
- }
|