Why Collider2D.OverlapPoint does not work with CompositeCollider2D? Is it a bug?

I have tried many times. It just not works at all. With the same shape, if I use a PolygonCollider2D, everything works fine. And if I replace PolygonCollider2D to a CompositeCollider2D composited by several BoxCollider2D, it does not work at all with the same code. It seems like a bug or something hasn’t be done yet.

It’ll work if the Geometry generation is set to Polygon. If it’s set to Outline then it’s producing edges which always return false for overlap point because they are infinitely thin (0 width) and there is no interior i.e. it’s not a solid collider. If you increase the edge radius then each edge has width and OverlapPoint will detect the edges.

When working with edges, typically you’d be using a Raycast to detect intersections with the edge only.

Think of it this way:
Outline = EdgeCollider2D
Polygon = PolygonCollider2D

1 Like