When to use mesh collision and when to use collision component?

I’m trying to take the Flying template and make a simple game prototype out of it.
I’m currently working on collision with the background elements and I was wondering about the collision system.
The flyingPawn created in this template has a collision shape on its mesh and that is what used for collision detection (blocking when hitting the walls etc.).
I also know from some other tutorials and examples that instead of using a collision component on the mesh you can add a collision component to the pawn’s blueprint such as: Box Collision, Sphere Collision and Capsule Collision.

My question is when do you choose one over the other?

The collision components are usually used for performance. The engine can use optimized collision checks for these simple shapes, whereas a mesh’ collision shape often consist of many triangles which can all potentially cause a collision or not. Because of that, a mesh’ collision shape is more expensive to check than a simple shape.

Another reason why collision components are used instead of the mesh’ shape is because the mesh may be missing collision primitives, because it wasn’t exported. The reason it may not have been exported could of course be because the modeler intended for the mesh’ collision to be done using capsules/boxes in the editor in the first place.

There are some situations where using the mesh’ collision can lead to better results, usually if you want precision. For example, if you want to ‘pick’ an actor using the cursor, that is detect which actor the cursor is hovering over, you may want to use the mesh’ precise shape.

ok, Thanks, I figured that it has something to do with performance. But I’m not talking specifically about the complex collision case which I guess is like per pixel collision. you can always use the static mesh editor to add a sphere or box collision, would these be the same as sphere and box collision component created as a separate component outside the mesh editor?

I think the performance would be roughly the same whether you create boxes and spheres in the mesh editor or in the blueprint editor. Adding the collision components in the blueprint editor will allow you to have separate collision profiles (object type, response to channels, etc) per component which can be useful.