I have a triangle with its perimeter represented by an EdgeCollider2D, and I want to trigger an event when the player reaches this area.

So I set the collider as a trigger and, I used the OnTriggerStay2D function in my code.

But the event works only when the player is intersecting the line of the collider, not when the player is inside the triangle but not touching the edge.

How can I continue to get OnTriggerStay messages when I'm inside the triangle, not touching the edges?


No, you cannot test collisions inside a region bounded by edge colliders.

An edge collider is just that: an edge. It has no internal area to test with, it's just the edge and nothing but the edge.

To represent a shape with an interior area, you can use a PolygonCollider2D.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.