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