Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        handL =
            VRTK_ControllerReference.GetControllerReference(SDK_BaseController.ControllerHand.Left);

        handR =
            VRTK_ControllerReference.GetControllerReference(SDK_BaseController.ControllerHand.Right);

        if (LeftController != null)
        {
            evL = LeftController.GetComponent <VRTK_ControllerEvents>();
        }
        if (RightController != null)
        {
            evR = RightController.GetComponent <VRTK_ControllerEvents>();
        }

        if (evR != null)
        {
            evR.ButtonOneReleased += new ControllerInteractionEventHandler(B1Released);
            evL.TriggerReleased   += new ControllerInteractionEventHandler(B1Released);
        }
    }
Exemplo n.º 2
0
        void Start()
        {
            LeftControllerEvents  = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(LeftController);
            RightControllerEvents = InputAdapter.Instance.ControllerInput.ControllerEventFactory.GetFrom(RightController);

            if (LeftControllerEvents == null || RightController == null)
            {
                Debug.LogError("Missing ControllerEvents!");
                return;
            }

            _leftTooltipAdapter  = LeftController.GetComponent <TooltipTransformAdapterBase>();
            _rightTooltipAdapter = RightController.GetComponent <TooltipTransformAdapterBase>();

            if (_leftTooltipAdapter == null || _rightTooltipAdapter == null)
            {
                Debug.LogError("Missing TooltipTransformAdapterBase!");
                return;
            }

            _leftTooltipAdapter.Init(TooltipControllers.Left);
            _rightTooltipAdapter.Init(TooltipControllers.Right);

            StartCoroutine(ControllerEventsSubscriptionSafe());

            _tooltipObjectsLeft  = new Dictionary <TooltipButtons, GameObject>();
            _tooltipObjectsRight = new Dictionary <TooltipButtons, GameObject>();
        }
Exemplo n.º 3
0
 private void Awake()
 {
     leftHand             = this.FindComponent <ActionBasedControllerManager>("XR Origin/Camera Offset/LeftHand");
     rightHand            = this.FindComponent <ActionBasedControllerManager>("XR Origin/Camera Offset/RightHand");
     _interactionManager  = this.FindComponent <XRInteractionManager>("XR Interaction Manager");
     locomotionSystem     = this.FindGameObject("Locomotion System");
     _mainCamera          = this.FindComponent <Camera>("XR Origin/Camera Offset/Main Camera");
     leftXRRayInteractor  = LeftController.GetComponent <XRRayInteractor>();
     rightXRRayInteractor = RightController.GetComponent <XRRayInteractor>();
 }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        handL =
            VRTK_ControllerReference.GetControllerReference(SDK_BaseController.ControllerHand.Left);

        handR =
            VRTK_ControllerReference.GetControllerReference(SDK_BaseController.ControllerHand.Right);

        if (LeftController != null)
        {
            evL = LeftController.GetComponent <VRTK_ControllerEvents>();
        }
        if (RightController != null)
        {
            evR = RightController.GetComponent <VRTK_ControllerEvents>();
        }

        if (evR != null)
        {
            evR.ButtonOneReleased += new ControllerInteractionEventHandler(RB1Released);
            evR.ButtonTwoReleased += new ControllerInteractionEventHandler(RB2Released);

            evL.ButtonOneReleased += new ControllerInteractionEventHandler(LB1Released);
            evL.ButtonTwoReleased += new ControllerInteractionEventHandler(LB2Released);


            evL.TriggerReleased += new ControllerInteractionEventHandler(RB1Released);
        }


        //

        Invoke("StartDemo", 0.5f); // obligé d'attendre un peu sinon la camera vrtk n'est pas chargée...

        //

        //Bezier.ControlPoints.Clear();

        foreach (Vector3 pos in TrackModel.TrackPositions) // on récupère nos boules éventuelles
        {
            Debug.Log("LOAD BALL AT " + pos);
            Vector3 newPos = pos * 30f;
            CreateBallAtPos(newPos);
        }
    }