I would like to know about more about the different types of collision bounds. I have a grasp of the basics, but I have a few more questions.
What’s the difference between Box and Triangle Mesh?
- What situations should I use each one in?
What is Capsule?
In general what is the relative speed of each type?
- From fastest to slowest, is it Triangle Mesh, Box, Cone, Cylinder, Cone, Capsule, Sphere, Convex Hull?
In short, the bounds determine the “shape” of the object seen by the physics engine.
So if you have a complicated character, the physics engine could calculate physics for every single verticie and face, but for a complex character this results in a frame-rate drop. So we can simplify it using “bounds” where it approximates the shape to a sphere, box etc.
From fastest to slowest with a description of how the engine handles it:
Box - 6 flat sides
Cylinder - a “wall” a set distance away from the object, with a flat surface top and bottom
Cone - a wall the distance away determined by the Z axis. Flat on the bottom
Capsule - two cones joined wide bit to wide bit
Convex Hull - Like triangle mesh but flattens out concave surfaces
Triangle Mesh - uses the mesh of the object for physics. The more polygons, the more maths and the slower it runs.
Hope that helped
These bounds are weird, and will not always act as you’d expect. Take box for example. If you made a cube, you’d use box for the collision bounds type, right? Maybe. Convex hull works better for most all collisions. I don’t have any idea why. For anything rigid body, I just use convex hull. It’s not very efficient, but the other shapes don’t seem to work very well.
Thanks for the clarification.
If I have a ground plane that consists of only a few faces or even just one, would triangle mesh actually be faster then all the other methods?
I will share what I know till we get a better answer. Basically the triangle mesh is saying, Ok we will use your current mesh and make that are physics volume. Now for each of the other except covex hull, imagine the shape each name depicts and imagine how that shape would act in a real world scenarion. A spere is more likely to roll than a box or cone. A capsule would look like a pill(think medicine pill) standing up. If you enable physics visualization in the game engine you can get a glimpse of what each option is doing.
ooops couple good post appeared while I was typing.
Box, sphere, cone, cylinder and capsule are simple geometry calculated in math so they are faster and more stable. sphere is by far the simplest math so it should be faster - the rest is probably ruffly equal. They don’t care about the mesh - only the objects bounding box - so You need to turn physics visualization on and check that they are properly aligned, else rotate the mesh so they match. For some forms radius matter I think - but for most not. Capsule is king for character collision boxes, collisions is far smother then for a box.
convex hull make some sort of optimized collision mesh matching the real mesh’s convex form. Contrary to 3dmedieval I fond it to mostly cause problem - how often do You have a convex form anyway?
Triangle mesh I found to work well, I have an unconfirmed feeling it works best when the mesh actually are a triangle mesh (no quads). If You have a high poly mesh it help to make a low poly collision object set to invisible and set the high poly object to no collision. Else it perform okay. I rarely bother with separate objects, as my graphics card suck my models are low poly enough to begin with. For terrain I find triangle mesh to be the given choice.
I just find that if things are not working as they should be, switching to convex hull usually solves the problem. Don’t know why.
Convex hull and triangle mesh is based on the mesh - so they are a bit more ‘automagic’ - we don’t need to match the mesh with the collision box orientation.
Yesterday I couldn’t get cube collision to work properly with a cube. Switched to CH. Automagic - good word, makes sense. Not very efficient, but for my test purpose, it didn’t matter.