Hi, I have some sprites in the game which need to have concave polygon colliders or even colliders with a few islands.
To detect tap on the sprite, I am using this method.
protected bool IsOverObject(Vector3 screenPosition, out RaycastHit hitInfo)
{
Ray ray = this.camera.ScreenPointToRay (screenPosition);
bool isOverObject = Physics.Raycast (ray, out hitInfo, Mathf.Infinity);
return isOverObject;
}
Appparently this only works if the collider is marked as convex. In that case however 2D toolkit connects all the islands and makes a bigger convex collider, and the casted ray hits that collider. Without "concave", the ray never intersects a collider, even if the tap was directly on one of the islands or on a point inside the concave collider.
So, what is the correct way to detect taps on concave colliders?