public virtual bool IsTeleportWalkableObjectSelected() { QuickUICursor cursor = GetCursor(); QuickUIInteractiveItem selectedItem = cursor? cursor.GetCurrentInteractible() : null; return(selectedItem && (selectedItem.GetComponent <QuickTeleportWalkableObject>() != null)); }
protected virtual void DeactiveLastInteractible() { if (_LastInteractible == null) { return; } _LastInteractible.Out(); _LastInteractible = null; }
protected virtual void EyeRaycast() { SetPosition(transform.position + transform.forward * _DefaultDistance, _DefaultDistance); // Create a ray that points forwards from the camera. _ray = ComputeRay(); float rLength = _RayLength; // Do the raycast forweards to see if we hit an interactive item if (Physics.Raycast(_ray, out _raycastResult, Mathf.Infinity, _RayCastMask)) { QuickUIInteractiveItem interactible = _raycastResult.collider.GetComponent <QuickUIInteractiveItem>(); //attempt to get the VRInteractiveItem on the hit object _CurrentInteractible = interactible; // If we hit an interactive item and it's not the same as the last interactive item, then call Over if (interactible && interactible != _LastInteractible) { interactible.Over(); } // Deactive the last interactive item if (interactible != _LastInteractible) { DeactiveLastInteractible(); } _LastInteractible = interactible; SetPosition(_raycastResult.point, _raycastResult.distance); rLength = _raycastResult.distance; } else { // Nothing was hit, deactive the last interactive item. DeactiveLastInteractible(); _CurrentInteractible = null; } Debug.DrawRay(_ray.origin, _ray.direction * rLength, Color.blue, 1.0f); }