Why is the Edge Collider 2D not used?

13_br_cud
2d
#1

Hey everyone,

Title is kind of self explanatory. I was wondering why, in the course, @Rick_Davidson uses three box colliders for the walls instead of one Edge Collider. This seems easier, or am I missing something here?

Thank you already for your explanation.

Cheers,
Ewoud

#2

Hi Ewoud,

An EdgeCollider2D logs collision on its edges only. Unity cannot handle fast moving objects well. Since our ball is moving fast, it might be that it moves beyond the edge without Unity noticing it. No collision would happen.

Nevertheless, feel free to test an EdgeCollider2D in your game. If it does the job, you may keep it. :slight_smile:

Has your question been answered?

1 Like
automatically bumped #3
#4

Hey Nina,

Thank you for your answer. I indeed didn’t think about the fast moving objects.
Just one question though, wouldn’t setting the collision detection on the ball to continuous fix that problem?
Of course this would make it more CPU heavy.

Greetings,
Ewoud

#5

I don’t know if that will work. Maybe it will. You could also increase some iteration values in the Physics2D Settings. Ultimately, you’ll have to test your game on multiple devices to see whether your solution fixes the problem. If it does, you may keep it. :slight_smile:

Ben’s/Rick’s solution has been tested by thousands of students in the past few years. It works.


See also: