1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using Rokid.UXR;
- using UnityEngine.UI;
- using Rokid.UXR.Module;
- using Rokid.UXR.Utility;
- using UnityEngine;
- public class UIOverlaySample : AutoInjectBehaviour
- {
- [Autowrited]
- private Button zeroDofButton;
- [Autowrited]
- private Button threeDofButton;
- [Autowrited]
- private Button sixDofButton;
- [Autowrited]
- private Toggle centerToggle;
- [Autowrited]
- private Toggle useLeftEyeFovToggle;
- private RKCameraRig cameraRig;
- private FollowCamera followCamera;
- private bool useLeftEyeFov = true;
- private bool adjustCenterByFov = true;
- private void Start()
- {
- cameraRig = MainCameraCache.mainCamera.transform.GetComponent<RKCameraRig>();
- followCamera = GameObject.Find("OverlayUI").GetComponent<FollowCamera>();
- zeroDofButton.onClick.AddListener(() =>
- {
- cameraRig.headTrackingType = RKCameraRig.HeadTrackingType.None;
- });
- threeDofButton.onClick.AddListener(() =>
- {
- cameraRig.headTrackingType = RKCameraRig.HeadTrackingType.RotationOnly;
- });
- sixDofButton.onClick.AddListener(() =>
- {
- cameraRig.headTrackingType = RKCameraRig.HeadTrackingType.RotationAndPosition;
- });
- centerToggle.onValueChanged.AddListener(selected =>
- {
- adjustCenterByFov = selected;
- followCamera.AdjustCenterByCameraByFov(adjustCenterByFov, useLeftEyeFov);
- });
- useLeftEyeFovToggle.onValueChanged.AddListener(selected =>
- {
- useLeftEyeFov = selected;
- followCamera.AdjustCenterByCameraByFov(adjustCenterByFov, useLeftEyeFov);
- });
- }
- }
|