Exemplo n.º 1
0
 /// <inheritdoc />
 public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
 {
     _gazeInputModule      = eventSystem.gameObject.AddComponent <GazeInputModule>();
     _fip                  = new GameObject("FallBackInputProvider").AddComponent <FallBackInputProvider>();
     _fip.transform.parent = playerRoot.transform;
     _gazeInputModule.SetGazeProvider(_fip);
 }
Exemplo n.º 2
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            _gazeProvider    = new XboxInputProvider();
            _gazeInputModule = eventSystem.gameObject.AddComponent <GazeInputModule>();
            _gazeInputModule.SetGazeProvider(_gazeProvider);

            _padProvider        = new XboxInputProvider();
            _gamePadInputModule = eventSystem.gameObject.AddComponent <GamePadInputModule>();
            _gamePadInputModule.SetGamePadProvider(_padProvider);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            Instantiate(_steamVRMainPrefab, playerRoot);
            SteamVR_ControllerManager cameraRig = Instantiate(_cameraRigPrefab, playerRoot);

            _laserInputModule = eventSystem.gameObject.AddComponent <MotionControllerInputModule>();

            _laserInputModule.LeftController = cameraRig.left.AddComponent <ViveController>();
            (_laserInputModule.LeftController as ViveController).NativeController = _laserInputModule.LeftController.GetComponent <SteamVR_TrackedObject>();
            _laserInputModule.LeftController.ControllerModel = _laserInputModule.LeftController.GetComponentInChildren <SteamVR_RenderModel>().gameObject;

            _laserInputModule.RightController = cameraRig.right.AddComponent <ViveController>();
            (_laserInputModule.RightController as ViveController).NativeController = _laserInputModule.RightController.GetComponent <SteamVR_TrackedObject>();
            _laserInputModule.RightController.ControllerModel = _laserInputModule.RightController.GetComponentInChildren <SteamVR_RenderModel>().gameObject;
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            _oculusGazeInputModule = eventSystem.gameObject.AddComponent <GazeInputModule>();
            _inputProvider         = new OculusGazeInput();

            if (VusrInput.CurrentVRDevice == VRDeviceMask.OculusAndroid)
            {
                _inputProvider.ControlType = OVRInput.Controller.Touchpad;
            }
            else if (VusrInput.CurrentVRDevice == VRDeviceMask.OculusWindows)
            {
                _inputProvider.ControlType = OVRInput.Controller.Remote;
            }

            _oculusGazeInputModule.SetGazeProvider(_inputProvider);

            _onFocusLost   = () => { VusrInput.VrFocusChanged(true); };
            _onFocusGained = () => { VusrInput.VrFocusChanged(false); };

            OVRManager.VrFocusLost     += _onFocusLost;
            OVRManager.VrFocusAcquired += _onFocusGained;
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            OVRCameraRig cameraRig = Instantiate(_ovrCameraRigPrefab, playerRoot);

            _laserInputModule = eventSystem.gameObject.AddComponent <MotionControllerInputModule>();

            _laserInputModule.LeftController = cameraRig.leftHandAnchor.gameObject.AddComponent <GearVRController>();
            (_laserInputModule.LeftController as GearVRController).ControllerType = Application.isEditor ? OVRInput.Controller.LTouch : OVRInput.Controller.LTrackedRemote;
            OVRTrackedRemote lModel = Instantiate(_trackedRemotePrefab, _laserInputModule.LeftController.transform).GetComponent <OVRTrackedRemote>();

            lModel.m_controller = (_laserInputModule.LeftController as GearVRController).ControllerType;
            _laserInputModule.LeftController.ControllerModel = lModel.gameObject;

            _laserInputModule.RightController = cameraRig.rightHandAnchor.gameObject.AddComponent <GearVRController>();
            (_laserInputModule.RightController as GearVRController).ControllerType = Application.isEditor ? OVRInput.Controller.RTouch : OVRInput.Controller.RTrackedRemote;
            OVRTrackedRemote rModel = Instantiate(_trackedRemotePrefab, _laserInputModule.RightController.transform).GetComponent <OVRTrackedRemote>();

            rModel.m_controller = (_laserInputModule.RightController as GearVRController).ControllerType;
            _laserInputModule.RightController.ControllerModel = rModel.gameObject;

            StartOVRSettings();
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            _laserInputModule = eventSystem.gameObject.AddComponent <MotionControllerInputModule>();

            DontDestroyOnLoad(OvrAvatarSDKManager.Instance.gameObject);

            OVRCameraRig cameraRig = Instantiate(_ovrCameraRigPrefab, playerRoot);

            _localAvatarPrefab.StartWithControllers = true;
            if (_localAvatarPrefab.SurfaceShader == null)
            {
                _localAvatarPrefab.SurfaceShader = _localAvatarPrefab.SurfaceShaderPBS;
            }
            if (_localAvatarPrefab.SurfaceShaderSelfOccluding == null)
            {
                _localAvatarPrefab.SurfaceShaderSelfOccluding = _localAvatarPrefab.SurfaceShaderPBS;
            }
            _ovrAvatar = Instantiate(_localAvatarPrefab, playerRoot);
            _laserInputModule.LeftController = cameraRig.leftHandAnchor.gameObject.AddComponent <OculusTouchController>();
            _ovrAvatar.ShowControllers(true);
            GameObject leftParent = new GameObject("LeftVisuals");

            leftParent.transform.parent = _ovrAvatar.ControllerLeft.transform.parent;
            _ovrAvatar.ControllerLeft.transform.parent       = leftParent.transform;
            _ovrAvatar.HandLeft.transform.parent             = leftParent.transform;
            _laserInputModule.LeftController.ControllerModel = leftParent;
            (_laserInputModule.LeftController as OculusTouchController).ControllerType = OVRInput.Controller.LTouch;

            _laserInputModule.RightController = cameraRig.rightHandAnchor.gameObject.AddComponent <OculusTouchController>();
            GameObject rightParent = new GameObject("RightVisuals");

            rightParent.transform.parent = _ovrAvatar.ControllerRight.transform.parent;
            _ovrAvatar.ControllerRight.transform.parent       = rightParent.transform;
            _ovrAvatar.HandRight.transform.parent             = rightParent.transform;
            _laserInputModule.RightController.ControllerModel = rightParent;
            (_laserInputModule.RightController as OculusTouchController).ControllerType = OVRInput.Controller.RTouch;
            StartCoroutine(DelayedApply());
        }
Exemplo n.º 7
0
        /// <inheritdoc />
        public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
        {
            //Create headset object
            Instantiate(_gvrHeadsetPrefab, playerRoot);

            //Create controller object
            Instantiate(_gvrControllerMainPrefab, playerRoot);
            _controllerRoot = Instantiate(_gvrControllerPointerPrefab, playerRoot).gameObject;
            Destroy(_controllerRoot.GetComponentInChildren <GvrLaserPointer>().gameObject);

            GameObject pointer = new GameObject("ControllerTracker");

            pointer.transform.parent = _controllerRoot.transform;
            pointer.AddComponent <GvrTrackedController>();
            _controller = pointer.gameObject.AddComponent <DaydreamController>();
            _controller.ControllerModel = _controllerRoot.GetComponentInChildren <GvrControllerVisual>().gameObject;

            //Tooltips creation
            _toolTipsObj = Instantiate(_gvrControllerTooltipsTemplate, _controller.ControllerModel.transform);
            GvrTooltip[] tooltips = _toolTipsObj.GetComponentsInChildren <GvrTooltip>();
            _insideSwipeTooltip  = tooltips.FirstOrDefault(t => t.name == "TouchPadInside");
            _outsideSwipeTooltip = tooltips.FirstOrDefault(t => t.name == "TouchPadOutside");
            _insideAppTooltip    = tooltips.FirstOrDefault(t => t.name == "AppButtonInside");
            _outsideAppTooltip   = tooltips.FirstOrDefault(t => t.name == "AppButtonOutside");

            _laserInputModule = eventSystem.gameObject.AddComponent <MotionControllerInputModule>();

            if (DaydreamController.IsLeftHanded())
            {
                _laserInputModule.LeftController = _controller;
            }
            else
            {
                _laserInputModule.RightController = _controller;
            }
        }
Exemplo n.º 8
0
 public override void Initialize(Transform playerRoot, VusrEventSystem eventSystem)
 {
     _gim = eventSystem.gameObject.AddComponent <GazeInputModule>();
     _gim.SetGazeProvider(new CardboardInputProvider());
 }