Trigger area versus perimeter

So in this lesson the box collider on the enemy triggers an OnTriggerExit2D event when it is no longer intersecting the boundary of the ground’s collision box.

Do collisions always react this way? Only the edges count? I must have not realized that during all the previous lessons.

So this would not work if we did not have Composite Collider 2D on the Tilemap, correct?

Also, is there a way to specify which of the two colliders on the enemy are colliding? Or if we wanted to do that we would have to put them on child objects?


In this project, we are using an edge collider for the tilemap environment. In the previous sections, we used “solid” colliders. Edge colliders do not have an “solid” body. The collider “area” is just the edge.

The OnTrigger* and OnCollision* methods get called whenever a collision happens, and it is not possible to distinguish between the colliders attached to the same game object. At least, I don’t know how to distinguish between them within the OnTrigger* or OnCollision* methods. Please feel free to ask our helpful community of students over on our Discord chat server.

In one of the next lectures, Rick shows a way how we can check if a specific collider collides with a specific layer.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.