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"); } } }
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(); }
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; } } } }
private void Awake() { steamVrLaserPointer = GameObject.FindObjectOfType <SteamVR_LaserPointer>(); steamVrLaserPointer.PointerIn += OnPointerIn; steamVrLaserPointer.PointerOut += OnPointerOut; steamVrLaserPointer.PointerClick += OnPointerClick; }
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); } }
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; } }
// Use this for initialization void Start() { Debug.Log("Menu handler is active"); controller = GetComponent <SteamVR_TrackedController>(); laser = GetComponent <SteamVR_LaserPointer>(); controller.TriggerClicked += selectButton; }
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>(); }
void Awake() { laserPointer = FindObjectOfType <SteamVR_LaserPointer>(); laserPointer.PointerIn += PointerInside; laserPointer.PointerOut += PointerOutside; laserPointer.PointerClick += PointerClick; }
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; } } }
void SetPointer() { if (pointer == null) { pointer = GetComponent <SteamVR_LaserPointer>(); } }
private void Awake() { steamVrLaserPointer = gameObject.GetComponent <SteamVR_LaserPointer>(); steamVrLaserPointer.PointerIn += OnPointerIn; steamVrLaserPointer.PointerOut += OnPointerOut; steamVrLaserPointer.PointerClick += OnPointerClick; }
// Use this for initialization void Start() { myEventSystem = GameObject.Find("EventSystem"); laserPointer = GetComponent<SteamVR_LaserPointer>(); laserPointer.PointerIn += LaserPointer_PointerIn; laserPointer.PointerOut += LaserPointer_PointerOut; }
private void Start() { pointer = GetComponent <SteamVR_LaserPointer>(); eventSystem = GameObject.Find("EventSystem"); pointer.PointerIn += PointerIn; pointer.PointerOut += PointerOut; }
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; }
private void OnEnable() { laserPointer = GetComponent <SteamVR_LaserPointer>(); laserPointer.PointerIn += HandlePointerIn; laserPointer.PointerOut += HandlePointerOut; laserPointer.PointerClick += HandlePointerClick; }
// Use this for initialization void Start() { myEventSystem = GameObject.Find("EventSystem"); laserPointer = GetComponent <SteamVR_LaserPointer>(); laserPointer.PointerIn += LaserPointer_PointerIn; laserPointer.PointerOut += LaserPointer_PointerOut; }
void Awake() { m_laserPointer = GetComponent <SteamVR_LaserPointer>(); m_laserPointer.PointerIn += OnPointerIn; m_laserPointer.PointerOut += OnPointerOut; m_controllerIndex = -1; }
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); } }
void Awake() { playAreaTransform = FindObjectOfType <SteamVR_PlayArea>().transform; playArea = FindObjectOfType <PlayAreaPhysics>(); trackedObj = GetComponent <SteamVR_TrackedObject>(); laserpointer = GetComponent <SteamVR_LaserPointer>(); jointList = new List <Joint>(); }
// Use this for initialization void Start() { laser = GetComponent <SteamVR_LaserPointer>(); controller = GetComponent <SteamVR_TrackedController>(); controller.TriggerClicked += LaserGrab; controller.TriggerUnclicked += LaserRelease; }
// 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> (); }
void OnDisable() { laserPointer = gameObject.GetComponent <SteamVR_LaserPointer>(); laserPointer.PointerIn -= OnPointerEnter; laserPointer.PointerOut -= OnPointerExit; laserPointer.PointerClick -= OnPointerClick; }
void OnEnable() { laserPointer = gameObject.GetComponent <SteamVR_LaserPointer>(); laserPointer.PointerIn += OnPointerEnter; laserPointer.PointerOut += OnPointerExit; laserPointer.PointerClick += OnPointerClick; }
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; }
// Use this for initialization void Start() { timer = 0f; curr = null; lp = Camera.main.gameObject.GetComponent <SteamVR_LaserPointer>(); lp.PointerIn += OnEnter; lp.PointerOut += OnExit; }
// 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); }
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; } }
void OnEnable() { laserPointer = GetComponent <SteamVR_LaserPointer>(); //이벤트 연결 laserPointer.PointerIn += OnPointerEnter; laserPointer.PointerOut += OnPointerExit; laserPointer.PointerClick += OnPointerClick; }
private void Awake() { gameObject.SetActive(Valve.VR.SteamVR.active); steamVrLaserPointer = gameObject.GetComponent <SteamVR_LaserPointer>(); steamVrLaserPointer.PointerIn += OnPointerIn; steamVrLaserPointer.PointerOut += OnPointerOut; steamVrLaserPointer.PointerClick += OnPointerClick; }
// 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; }