0
\$\begingroup\$

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?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .