Curiosity of using colliders

I just noticed that Rick is using Capsule collider 2D for most of the player character, the same goes for the player’s car in Delivery Driver. So I’m wondering what’s the difference? Why don’t we use box collider 2D instead? Maybe Rick will explain this in the future lecture but i just cant hold back my thoughts since I’m using box collider and things go fine by me.

And here he is, since we fixed the gap issues with the composite colliders, maybe there is no big difference? perhaps if we use a capsule collider we can’t stand on edges to make a long jump? or maybe the player will fall off even when his foot is still on the tilemap?
image

2 Likes

Hi,

That’s a good question. Maybe Rick figured that the CapsuleCollider2D matched the overall shape of the car and ‘Ginger’ best. Personally, I would probably opt for a BoxCollider2D because ‘Ginger’ is rather a rectangle than an ellipse. However, I would move the edges of the collider closer to the sprite because there is a rather large space in front of the player, which might look odd in certain cases, for example, even though the player sprite does not touch the enemy, the enemy could still kill him.

Use the collider shape you want and try to keep it as simple as possible because simple shapes are more performant than complex shapes. If some details do not work perfectly (yet), you’ll have to finetune things but that’s something you always have to do in your games.

Did this help?


See also:

2 Likes

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

Privacy & Terms