I prefer modelling my collisions manually outside of Unreal, so I’m wonder how the primitives (cube, capsule & sphere) are handled within Unreal and what would be better performance wise.
Are these primitives (specifically capsule and sphere) calculated differently to geometry made of triangles? Is for example the capsule the same as using a 16-sided cylinder modelled mesh?
What’s better performance wise, what’s the difference between modelling them manually?
Performance wise I’ve always heard that modelled collision is a higher cost by a very small margin and that UE4’s simple collision is much faster. There is a lot of instances you need to use one for say bullets and the other for movement. So like on games I’ve worked on I’ve had the mesh block projectiles but the capsule block movement. Meaning only very quick and rare hits against the static mesh is the only one that truly uses the modelled collision because skeletal meshes are usually PHAT bodies specifically tailored to the games needs.
You get the best of both worlds by prefixing your collision mesh objects and exporting them in the same fbx as the rendered mesh.
For example if you made 5 box collider objects for a mesh named TrashCan they would be named:
Other Prefixes for collisions are:
- UCP (for capsules)
- USP (for spheres)
- UCX (for convex objects)
You can read more about it here FBX Static Mesh Pipeline | Unreal Engine Documentation
Thanks, but I’m already aware of this. My question was whether there’s a difference between the primitives and a manually made ‘UCX’ variant.
Yes there is a difference since UCX is a more complex calculation than UBX however in order for UBX to be faster it assumes many things like it has 6 sides that are perpendicular and that the mesh scale is Uniform etc.
Collision tests grow exponentially so even a little increase in the individual mesh tests will impact the overall performance. That said for small projects it may not be worth it, as long as you keep the UCX shapes as simple as possible.