diff --git a/Assets/RothenburgAR/Scripts/UI/InputManager.cs b/Assets/RothenburgAR/Scripts/UI/InputManager.cs index 494a864..5c9a771 100644 --- a/Assets/RothenburgAR/Scripts/UI/InputManager.cs +++ b/Assets/RothenburgAR/Scripts/UI/InputManager.cs @@ -28,7 +28,7 @@ namespace RothenburgAR.UI } } - public void DoRaycast(Vector2 screenPoint) + public void DoRaycast(Vector2 screenPoint, bool denyBlockedHits = true) { RaycastHit hitInfo = new RaycastHit(); Ray ray = Camera.main.ScreenPointToRay(screenPoint); @@ -39,28 +39,28 @@ namespace RothenburgAR.UI GameObject go = hitInfo.transform.gameObject; var bb = go.GetComponent(); if (bb == null) return; - if (AbortBecauseDetailsPanelHit(screenPoint)) return; + if (denyBlockedHits && DenyBlockedHits(screenPoint)) return; bb.OnClick.Invoke(); } - private bool AbortBecauseDetailsPanelHit(Vector2 screenPoint) + private bool DenyBlockedHits(Vector2 screenPoint) { if (!UIManager.Instance.IsARViewVisible) return true; - + var pointer = new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current); pointer.position = screenPoint; List results = new List(); var _raycaster = UIManager.Instance.ARViewBehaviour.GetComponent(); _raycaster.Raycast(pointer, results); - + return results.Count != 0; } public void ActivateCrosshairs() { Vector2 center = new Vector2(Camera.main.pixelWidth / 2, Camera.main.pixelHeight / 2); - DoRaycast(center); + DoRaycast(center, false); } private List GatherScreenPoints()