Rigidbody vs Circle Collider vs Box Collider

Hi everyone,

I just started learning Unity and I am a little confused between these three components; Rigidbody, Circle Collider, and Box Collider. I read the description on Unity Scripts documentation but I don’t really understand them. Could anyone explain what they are for and when to use each component?

Thanks

A rigidbody component is the component which allows an object to be affected by the physics system. Affected by the impact of another object, be affected by drag, have a velocity, have a force applied, etc. Colliders are also tied in with the physics system, basically setting boundaries around objects. As far as the physics system is concerned, they are the surface of the objects.

The difference between circular and box colliders is just the shape. While you can use an object’s mesh for a mesh collider, doing so is usually unnecessarily expensive on the CPU. Instead the typical approach is placing multiple box colliders on child objects to form what Unity calls a compound collider in the rough shape of the object.

4 Likes

Though a “circle” is a 2D shape and a “box” is a 3D shape. I don’t believe that 2D and 3D physics objects can interact with each other.

2 Likes

Colliders are the “shape” of the object. They can actually be used without the physics engine controlling them as triggers. You can then have events in your scripts respond to trigger collisions.

The rigidbody component is the part that takes the object out of your direct control and makes it part of the actual physics engine. Then, it is either kinematic or not. If it is kinematic, you still control it directly, and it can interact with physics objects without having them act on it. A good example of this would be moving platforms in a game, you want them to push your character around, but not be affected by other things.

Then if something is NOT kinematic, it is a normal physics object. You don’t control it directly anymore, rather you use forces on it. It also gets affected by other things, bouncing on walls, getting pushed by forces you created on enemies, getting bumped turned by bullets, etc…

So, colliders control the shape for collision detection purposes, whether you use the physics engine with it or not. And then adding the rigidbody is the “toggle” that adds the object into the physics engine.

If you have a specific project in mind or something you are trying to do, feel free to explain it and we can possibly provide advice as to what setup you would need.

I have it understood that they are using 2 separate physics engines and indeed would not be able to interact at all. Of course you could easily have any components on those objects, so nothing stops you from using 3d models on objects that are affected by 2d physics(not that you asked this or anything). So I think the confusion here is more about circle vs sphere, etc… The good part is that Unity added “2d” for all the 2d colliders so it shouldn’t be confusing.

3 Likes

Yeah my mind went straight to sphere when reading circle :stuck_out_tongue:

1 Like