A collider is a 3D model that is used in-game to determine how objects collide with each other. Each object has at least one collider. If you don’t specify one, a box that covers the whole visible object is generated automatically. In many cases, that will be enough and you don’t need to worry about colliders. But if your object shape isn’t represented well by a box, read on to find out how to work with colliders.
In the editor, you can add two types of colliders: Spheres and models. Use a sphere for perfectly round objects, you only have to set the center of the sphere and its radius.
Collider models are more flexible: you can load any 3D model and a collider will be created from it. You can then set its position, rotation, and scale in the same way as for visible models. Click on the eye icon on top of the collider pane to visualize your colliders.
There are some important differences between collider models and regular visual models, though: colliders are always convex (they can’t have holes or dents), and they should not have complex geometry or performance will suffer. When you try to use a non-convex model as a collider, its convex hull will be used instead. Calculating the convex hull can take quite some time for complex models, which is another reason to only use simple geometry as colliders.
If your object needs a collision shape that is not convex, you can combine multiple colliders to create it. As long as each single collider is concave, the collision shape of the whole object can be anything you want. You should still try to keep it as simple as possible and use as few colliders as you can get away with to keep performance high!
Collision for tables works differently from other objects: You can also provide your own colliders own colliders if you want, but if you don’t add any colliders you don’t get a box around the table. Instead, the actual visible geometry is used for collision, even if it is complex and has holes and dents! This works because tables never move in the game.