private void HandlePointerAction(Vector2 cameraPosition, OnPointer eventToNotify) { //TODO: always the same value. needs z value. is it not valuable at all? Vector3 worldPosition = Camera.main.ScreenToWorldPoint(cameraPosition); RaycastHit2D[] results = null; if (_providePonterRaycast) { results = new RaycastHit2D[_maxRaycastResults]; Physics2D.Raycast(worldPosition, Vector2.zero, _contactFilter, results); } if (eventToNotify != null) { eventToNotify(cameraPosition, worldPosition, results); } }
private void HandlePointerAction(Vector3 cameraPosition, OnPointer eventToNotify) { cameraPosition.z = 10; //TODO: always the same value. needs z value. is it not valuable at all? Vector3 worldPosition = Camera.main.ScreenToWorldPoint(cameraPosition); Ray ray = Camera.main.ScreenPointToRay(cameraPosition); _ray = ray; RaycastHit results = default(RaycastHit); if (_providePonterRaycast) { // Physics.Raycast(worldPosition, Camera.main.transform.forward,out results); Physics.Raycast(ray, out results); } if (eventToNotify != null) { eventToNotify(worldPosition, results); } }
private void HandleMultiPointerAction(Vector2 cameraPosition, int index, OnMultiPointer eventToNotify, OnPointer pointerEventToNotify) { Vector3 worldPosition = Camera.main.ScreenToWorldPoint(cameraPosition); RaycastHit2D[] results = null; if (_providePonterRaycast) { results = new RaycastHit2D[_maxRaycastResults]; Physics2D.Raycast(worldPosition, Vector2.zero, _contactFilter, results); } if (eventToNotify != null) { eventToNotify(cameraPosition, worldPosition, index, results); } if (index == 0 && pointerEventToNotify != null) { pointerEventToNotify(cameraPosition, worldPosition, results); } }
private void HandleMultiPointerAction(Vector2 cameraPosition, int index, OnMultiPointer eventToNotify, OnPointer pointerEventToNotify) { Vector3 worldPosition = Camera.main.ScreenToWorldPoint(cameraPosition); RaycastHit results = default(RaycastHit); if (_providePonterRaycast) { Physics.Raycast(cameraPosition, Camera.main.transform.forward, out results); } if (eventToNotify != null) { eventToNotify(cameraPosition, index, results); } if (index == 0 && pointerEventToNotify != null) { pointerEventToNotify(cameraPosition, results); } }