コード例 #1
0
    public SteamVR_LaserPointer pointer;              //!< pointer to the laser pointer at end of controller

    /*!
     * \brief initializes variables
     * \details This function initializes the pointers to the scene such as controllers,
     */
    void Awake()
    {
        GameObject controllerObject = GameObject.FindGameObjectWithTag("Right Controller") as GameObject;

        if (controllerObject != null & controller == null)
        {
            controller = controllerObject.GetComponent <SteamVR_TrackedObject>();
        }
        else
        {
            Debug.Log("controllerObject returned null");
        }
        if (controller != null)
        {
            try
            {
                pointer         = controller.GetComponent <SteamVR_LaserPointer>();
                controllerInput = controller.GetComponent <SteamVR_TrackedController>();
            }
            catch
            {
                Debug.LogError(this.name + ": Could not find LaserPointer");
            }
        }
    }
コード例 #2
0
ファイル: Processing.cs プロジェクト: mc17uulm/Heisenberg
    void OnEnable()
    {
        Index = 0;

        Config.init();
        Debug.Log("UserID: " + Config.UserId);
        Session.Initalize();

        LaserPointer = GetComponent <SteamVR_LaserPointer>();

        Rounds = 0;

        LTC = new LatinSquare(8);
        LTT = new LatinSquare(Config.TargetAmplitudes.Length * Config.TargetWidths.Length);

        Tasks = CreateTasks(LTC, LTT);

        UpdateTask();
        HideTimer();

        State = State.START;

        ShowCommand("Start");
        Tunnel.IsInitalized();
    }
コード例 #3
0
ファイル: VRPlayer.cs プロジェクト: brandonmousseau/vhvr-mod
 private void tryInitializeHands()
 {
     // First try and initialize both hands and pointer scripts
     if (_leftHand == null || _leftPointer == null)
     {
         _leftHand = getHand(LEFT_HAND, _instance);
         if (_leftHand != null)
         {
             _leftPointer = _leftHand.GetComponent <SteamVR_LaserPointer>();
             if (_leftPointer != null)
             {
                 _leftPointer.raycastLayerMask = LayerUtils.UI_PANEL_LAYER_MASK;
             }
         }
     }
     if (_rightHand == null || _rightPointer == null)
     {
         _rightHand = getHand(RIGHT_HAND, _instance);
         if (_rightHand != null)
         {
             _rightPointer = _rightHand.GetComponent <SteamVR_LaserPointer>();
             if (_rightPointer != null)
             {
                 _rightPointer.raycastLayerMask = LayerUtils.UI_PANEL_LAYER_MASK;
             }
         }
     }
 }
コード例 #4
0
 private void Awake()
 {
     steamVrLaserPointer               = GameObject.FindObjectOfType <SteamVR_LaserPointer>();
     steamVrLaserPointer.PointerIn    += OnPointerIn;
     steamVrLaserPointer.PointerOut   += OnPointerOut;
     steamVrLaserPointer.PointerClick += OnPointerClick;
 }
コード例 #5
0
    void Update()
    {
        try
        {
            if (pointer != null && buttons != null)
            {
                Raycast();
            }

            if (pointer == null)
            {
                pointer = controllerRight.GetComponent <SteamVR_LaserPointer>();
            }

            if (buttons == null)
            {
                buttons = controllerRight.GetComponent <SteamVR_TrackedController>();
            }

            if (sn == null)
            {
                sn = GameObject.Find("Points").gameObject.GetComponent <Points>();
            }
        }
        catch (Exception e)
        {
            //Debug.Log(e);
        }
    }
コード例 #6
0
    void UpdatePointerStrength(SteamVR_LaserPointer pointer)
    {
        // Don't update the pointer strength if there's nothing to point at.
        if (Pointable == null)
        {
            return;
        }

        float gazeDistance = CalculateLookDistance(HMD.transform, Pointable.transform);

        // If the player isn't even looking towards the pedestal, don't show pointers.
        if (gazeDistance > HeadThreshold)
        {
            pointer.thickness = 0f;
            return;
        }

        // Show pointers if they're pointing in the right direction.
        float pointerDistance = CalculateLookDistance(pointer.transform, Pointable.transform);

        if (pointerDistance < PointerOnThreshold)
        {
            pointer.thickness = PointerMaxThickness;
        }
        else if (pointerDistance < PointerVisibleThreshold)
        {
            pointer.thickness = (
                1f - (pointerDistance - PointerOnThreshold) / (PointerVisibleThreshold - PointerOnThreshold))
                                * PointerMaxThickness;
        }
        else
        {
            pointer.thickness = 0f;
        }
    }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("Menu handler is active");
     controller = GetComponent <SteamVR_TrackedController>();
     laser      = GetComponent <SteamVR_LaserPointer>();
     controller.TriggerClicked += selectButton;
 }
コード例 #8
0
    private SteamVR_LaserPointer pointer;              //!< pointer to the laser pointer

    /*!
     * \brief initializes variables
     * \details This function initializes the pointers to the scene such as controllers, laser pointer, teleporter
     */
    void Awake()
    {
        controller      = GetComponent <SteamVR_TrackedObject>();
        controllerInput = GetComponent <SteamVR_TrackedController>();
        teleporter      = GetComponent <SteamVR_Teleporter>();
        pointer         = GetComponent <SteamVR_LaserPointer>();
    }
コード例 #9
0
 void Awake()
 {
     laserPointer               = FindObjectOfType <SteamVR_LaserPointer>();
     laserPointer.PointerIn    += PointerInside;
     laserPointer.PointerOut   += PointerOutside;
     laserPointer.PointerClick += PointerClick;
 }
コード例 #10
0
ファイル: VRGUI.cs プロジェクト: bsparks/vhvr-mod
 private void maybeInitializePointers()
 {
     if (VRPlayer.instance == null)
     {
         return;
     }
     if (_leftPointer == null)
     {
         _leftPointer = VRPlayer.leftPointer;
         if (_leftPointer != null)
         {
             _leftPointer.PointerClick    += OnPointerClick;
             _leftPointer.PointerTracking += OnPointerTracking;
         }
     }
     if (_rightPointer == null)
     {
         _rightPointer = VRPlayer.rightPointer;
         if (_rightPointer != null)
         {
             _rightPointer.PointerClick    += OnPointerClick;
             _rightPointer.PointerTracking += OnPointerTracking;
         }
     }
 }
コード例 #11
0
 void SetPointer()
 {
     if (pointer == null)
     {
         pointer = GetComponent <SteamVR_LaserPointer>();
     }
 }
コード例 #12
0
 private void Awake()
 {
     steamVrLaserPointer               = gameObject.GetComponent <SteamVR_LaserPointer>();
     steamVrLaserPointer.PointerIn    += OnPointerIn;
     steamVrLaserPointer.PointerOut   += OnPointerOut;
     steamVrLaserPointer.PointerClick += OnPointerClick;
 }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     myEventSystem = GameObject.Find("EventSystem");
     laserPointer = GetComponent<SteamVR_LaserPointer>();
     laserPointer.PointerIn += LaserPointer_PointerIn;
     laserPointer.PointerOut += LaserPointer_PointerOut;
 }
コード例 #14
0
 private void Start()
 {
     pointer             = GetComponent <SteamVR_LaserPointer>();
     eventSystem         = GameObject.Find("EventSystem");
     pointer.PointerIn  += PointerIn;
     pointer.PointerOut += PointerOut;
 }
コード例 #15
0
    private void OnEnable()

    {
        laserPointer = GetComponent <SteamVR_LaserPointer>();

        laserPointer.PointerIn -= HandlePointerIn;

        laserPointer.PointerIn += HandlePointerIn;

        laserPointer.PointerOut -= HandlePointerOut;

        laserPointer.PointerOut += HandlePointerOut;



        trackedController = GetComponent <SteamVR_TrackedController>();

        if (trackedController == null)

        {
            trackedController = GetComponentInParent <SteamVR_TrackedController>();
        }

        trackedController.TriggerClicked -= HandleTriggerClicked;

        trackedController.TriggerClicked += HandleTriggerClicked;
    }
コード例 #16
0
ファイル: VRUIInput.cs プロジェクト: nanalucky/AP
 private void OnEnable()
 {
     laserPointer               = GetComponent <SteamVR_LaserPointer>();
     laserPointer.PointerIn    += HandlePointerIn;
     laserPointer.PointerOut   += HandlePointerOut;
     laserPointer.PointerClick += HandlePointerClick;
 }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     myEventSystem            = GameObject.Find("EventSystem");
     laserPointer             = GetComponent <SteamVR_LaserPointer>();
     laserPointer.PointerIn  += LaserPointer_PointerIn;
     laserPointer.PointerOut += LaserPointer_PointerOut;
 }
コード例 #18
0
 void Awake()
 {
     m_laserPointer             = GetComponent <SteamVR_LaserPointer>();
     m_laserPointer.PointerIn  += OnPointerIn;
     m_laserPointer.PointerOut += OnPointerOut;
     m_controllerIndex          = -1;
 }
コード例 #19
0
 private void checkAndSetHandsAndPointers()
 {
     // First try and initialize both hands and pointer scripts
     if (_leftHand == null || _leftPointer == null)
     {
         _leftHand = getHand(LEFT_HAND, _instance);
         if (_leftHand != null)
         {
             _leftPointer = _leftHand.GetComponent <SteamVR_LaserPointer>();
         }
     }
     if (_rightHand == null || _rightPointer == null)
     {
         _rightHand = getHand(RIGHT_HAND, _instance);
         if (_rightHand != null)
         {
             _rightPointer = _rightHand.GetComponent <SteamVR_LaserPointer>();
         }
     }
     if (_leftHand != null)
     {
         _leftHand.enabled = VVRConfig.HandsEnabled();
     }
     if (_rightHand != null)
     {
         _rightHand.enabled = VVRConfig.HandsEnabled();
     }
     // Next check whether the hands are active, and enable the appropriate pointer based
     // on what is available and what the options set as preferred. Disable the inactive pointer(s).
     if (handIsActive(_leftHand, _leftPointer) && handIsActive(_rightHand, _rightPointer))
     {
         // Both hands active, so choose preferred hand
         if (_preferredHand == LEFT_HAND)
         {
             setPointerActive(_leftPointer, true);
             setPointerActive(_rightPointer, false);
         }
         else
         {
             setPointerActive(_rightPointer, true);
             setPointerActive(_leftPointer, false);
         }
     }
     else if (handIsActive(_rightHand, _rightPointer))
     {
         setPointerActive(_rightPointer, true);
         setPointerActive(_leftPointer, false);
     }
     else if (handIsActive(_leftHand, _leftPointer))
     {
         setPointerActive(_leftPointer, true);
         setPointerActive(_rightPointer, false);
     }
     else
     {
         setPointerActive(_leftPointer, false);
         setPointerActive(_rightPointer, false);
     }
 }
コード例 #20
0
ファイル: SteamVRControls.cs プロジェクト: hatsuna/Wayfarer
 void Awake()
 {
     playAreaTransform = FindObjectOfType <SteamVR_PlayArea>().transform;
     playArea          = FindObjectOfType <PlayAreaPhysics>();
     trackedObj        = GetComponent <SteamVR_TrackedObject>();
     laserpointer      = GetComponent <SteamVR_LaserPointer>();
     jointList         = new List <Joint>();
 }
コード例 #21
0
    // Use this for initialization
    void Start()
    {
        laser      = GetComponent <SteamVR_LaserPointer>();
        controller = GetComponent <SteamVR_TrackedController>();

        controller.TriggerClicked   += LaserGrab;
        controller.TriggerUnclicked += LaserRelease;
    }
コード例 #22
0
 // Start is called before the first frame update
 void Start()
 {
     pointer = GetComponent <SteamVR_LaserPointer> ();
     Goal1   = GameObject.Find("/Goal1");
     Goal2   = GameObject.Find("/Goal2");
     g1      = Goal1.GetComponent <Goal> ();
     g2      = Goal2.GetComponent <Goal> ();
 }
コード例 #23
0
    void OnDisable()
    {
        laserPointer = gameObject.GetComponent <SteamVR_LaserPointer>();

        laserPointer.PointerIn    -= OnPointerEnter;
        laserPointer.PointerOut   -= OnPointerExit;
        laserPointer.PointerClick -= OnPointerClick;
    }
コード例 #24
0
    void OnEnable()
    {
        laserPointer = gameObject.GetComponent <SteamVR_LaserPointer>();

        laserPointer.PointerIn    += OnPointerEnter;
        laserPointer.PointerOut   += OnPointerExit;
        laserPointer.PointerClick += OnPointerClick;
    }
コード例 #25
0
 private void Awake()
 {
     leftHandLaserPointer                    = Player.instance.GetComponentsInChildren <SteamVR_LaserPointer>()[0];
     rightHandLaserPointer                   = Player.instance.GetComponentsInChildren <SteamVR_LaserPointer>()[1];
     scenarioManager.FeedbackCanvas          = this.GetComponent <Canvas>();
     scenarioManager.ExtinguisherSpawnPoint  = extinguisherSpawnPoint;
     scenarioManager.Extinguisher2SpawnPoint = extinguisher2SpawnPoint;
 }
コード例 #26
0
 // Use this for initialization
 void Start()
 {
     timer          = 0f;
     curr           = null;
     lp             = Camera.main.gameObject.GetComponent <SteamVR_LaserPointer>();
     lp.PointerIn  += OnEnter;
     lp.PointerOut += OnExit;
 }
コード例 #27
0
 // Returns true if both the hand and pointer are not null
 // and the hand is active
 private bool handIsActive(Hand h, SteamVR_LaserPointer p)
 {
     if (h == null || p == null)
     {
         return(false);
     }
     return(h.enabled && h.isActive && h.isPoseValid);
 }
コード例 #28
0
 private void Awake()
 {
     _trackedObj = Controller.GetComponent <SteamVR_TrackedObject> ();
     _pointer    = Controller.GetComponent <SteamVR_LaserPointer> ();
     if (_pointer == null && Controller.GetComponent <SteamVR_LaserPointer> () == null)
     {
         _pointer = Controller.AddComponent <SteamVR_LaserPointer> () as SteamVR_LaserPointer;
     }
 }
コード例 #29
0
ファイル: CastEventUI.cs プロジェクト: shiaru/ViveLecture
    void OnEnable()
    {
        laserPointer = GetComponent <SteamVR_LaserPointer>();

        //이벤트 연결
        laserPointer.PointerIn    += OnPointerEnter;
        laserPointer.PointerOut   += OnPointerExit;
        laserPointer.PointerClick += OnPointerClick;
    }
コード例 #30
0
ファイル: Pointer.cs プロジェクト: TheMogwai/Mahi-formation
        private void Awake()
        {
            gameObject.SetActive(Valve.VR.SteamVR.active);

            steamVrLaserPointer               = gameObject.GetComponent <SteamVR_LaserPointer>();
            steamVrLaserPointer.PointerIn    += OnPointerIn;
            steamVrLaserPointer.PointerOut   += OnPointerOut;
            steamVrLaserPointer.PointerClick += OnPointerClick;
        }
コード例 #31
0
 // Start is called before the first frame update
 void Awake()
 {
     soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>();
     gameManager  = GameObject.Find("GameManager").GetComponent <GameManager>();
     hand         = GameObject.Find("RightHand");
     laserPointer = GameObject.Find("RightHand").GetComponent <SteamVR_LaserPointer>();
     laserPointer.PointerClick += PointerClick;
     selected = false;
 }