Why not just use Mesh Collider?

I know there are multiple ways to go about all these lessons, so I added a Mesh Collider to the parent object of the Enemy ships in my Scene, and it works just fine. Lasers hit it, collisions work great, it takes my Points to Hit into consideration just fine.

Since this wasn’t the method used in the lesson (instead it uses the Add Rigid Body method), I’m wondering: what are the pros and cons to doing the Add Rigidbody method in comparison is adding a Mesh Collider to them? Is one more performance expensive than the other?

Hi,

In many cases, there are multiple ways to make something work in Unity, and Rick cannot show all of them. If your code works, it’s a solution by definition.

A MeshCollider and a Rigidbody method are two different things that do not have anything to do with one another. The Rigidbody usually refers to the movement within the physics simulation, and the collider refers to the ability to collide with other colliders. For this reason, I’m afraid I cannot answer your questions. What exactly would you like to know?

As @Nina already mentioned, Colliders and Rigidbodies are two different things.

Mesh colliders are computationally more ‘expensive’ to use and in most cases not necessary. In a small game, you may not notice the difference, but when your game starts spawning hundreds of asteroids and enemy ships, and they all have mesh colliders, it will start to show. In the majority of cases it is sufficient to use a simpler, primitive collider instead.

Thank you both! My question was essentially answered. My method worked after all, and there are no wrong answers, so I’ll take it! As long as it works. And duly noted, I will remember how mesh colliders are more costly on performance.

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

Privacy & Terms