Esempio n. 1
0
        private void Start()
        {
            var controllers = Actor.GetScriptsRecursive <VRController>();

            left  = controllers.Where(c => c.Role == VRControllerRole.LeftHand).First();
            right = controllers.Where(c => c.Role == VRControllerRole.RightHand).First();

            camera = Actor.GetScript <VRCameraRig>().LeftEyeCamera;
        }
Esempio n. 2
0
        private void SetupHierarchy()
        {
            if (TrackingSpace == null)
            {
                TrackingSpace = ConfigureRootAnchor(trackingSpaceName);
            }

            if (LeftEyeAnchor == null)
            {
                LeftEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.LeftEye);
            }

            if (CenterEyeAnchor == null)
            {
                CenterEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.CenterEye);
            }

            if (RightEyeAnchor == null)
            {
                RightEyeAnchor = ConfigureEyeAnchor(TrackingSpace, VREyeType.RightEye);
            }

            if (TrackerAnchor == null)
            {
                TrackerAnchor = ConfigureTrackerAnchor(TrackingSpace);
            }

            if (LeftControllerAnchor == null)
            {
                LeftControllerAnchor = ConfigureControllerAnchor(TrackingSpace, VRControllerRole.LeftHand);
                LeftController       = LeftControllerAnchor.GetScript <VRController>();
            }

            if (RightControllerAnchor == null)
            {
                RightControllerAnchor = ConfigureControllerAnchor(TrackingSpace, VRControllerRole.RightHand);
                RightController       = RightControllerAnchor.GetScript <VRController>();
            }

            if (LeftEyeCamera == null || RightEyeCamera == null || AttachedCamera == null)
            {
                LeftEyeCamera = LeftEyeAnchor.GetChild <Camera>();
                if (LeftEyeCamera == null)
                {
                    LeftEyeCamera = Camera.New();
                    LeftEyeAnchor.AddChild(LeftEyeCamera);
                }

                RightEyeCamera = RightEyeAnchor.GetChild <Camera>();
                if (RightEyeCamera == null)
                {
                    RightEyeCamera = Camera.New();
                    RightEyeAnchor.AddChild(RightEyeCamera);
                }

                AttachedCamera = CenterEyeAnchor.GetChild <Camera>();
                if (AttachedCamera == null)
                {
                    AttachedCamera = Camera.New();
                    CenterEyeAnchor.AddChild(AttachedCamera);
                }
            }

            vrControllers = Actor.GetScriptsRecursive <VRController>();

            RefreshVRMode();
            RefreshCameraProperties();

            isInitialized = true;
        }