private void SetupPointer()
        {
            CreatePointer();

            pointer.SetActive(true);

            GvrLaserPointer laser = pointer.GetComponentInChildren <GvrLaserPointer>();

            Assert.IsNotNull(laser);
            laser.SetAsMainPointer();

            // Turn off tooltips.
            GvrTooltip tooltip = pointer.GetComponentInChildren <GvrTooltip>();

            if (tooltip != null)
            {
                tooltip.transform.parent.gameObject.SetActive(false);
            }
        }
Exemplo n.º 2
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;
            }
        }