private void HideOutline() { LineMaterial.color = lineColorOrig; if (lastOutline != null) { lastOutline.enabled = false; } lastOutline = null; }
void Update() { if (XRTeleporterController.Instance.IsTeleporterActive()) { return; } //m_pointBlend = inputManager.GetTriggerAxis(); //if (m_pointBlend > 0.01f && m_pointBlend < 0.9f) if (inputManager.IsTriggerDown()) { lp.OnInputFocusAcquired(); _startPoint = eyeTransform.position + eyeTransform.transform.right * offset.x + eyeTransform.transform.up * offset.y + eyeTransform.transform.forward * offset.z; _endPoint = eyeTransform.transform.forward * 1000f; _normal = Vector3.one; // do a forward raycast to see if we hit a Button if (Physics.Raycast(_startPoint, eyeTransform.forward, out hit, 100f, layers)) { _endPoint = hit.point; _normal = hit.normal; Outline OutlineAux = hit.transform.GetComponent <Outline>(); if (lastOutline == null) { lastOutline = OutlineAux; } else if (lastOutline != OutlineAux) { HideOutline(); lastOutline = OutlineAux; } ShowOutline(); //Debug.Log("VRShowLineRendererByClick: RayCast Hit Detected -> Normal: " + _normal); } else { HideOutline(); } //lp.SetCursorRay(eyeTransform); /*if (!myOVRInputModule.isUIDetected) /**/ { lp.SetCursorStartDest(_startPoint, _endPoint, _normal); } } else { lp.OnInputFocusLost(); HideOutline(); } }