What I mean by this is, will they detect “collisions” if an object is found to be inside of them? I have found that a regular box collider will, but a non convex mesh collider will not. I have included a diagram of the test I have been using (I was having a hard time trying to explain it).
If some wonderful person could explain to me exactly how / why I am getting this result that would be great
Ok that’s what I suspected. Right now most of our meshes aren’t caped but i did play around with one that was. what kind of difference would i see as a result of capped vs. not capped?
The Convex checkbox is short for “convex hull”. A convex hull is the minimal convex volume that contains a set of points in 3D (more info here). The key word there is “volume,” because without volume a mesh collider is just a set of one-sided triangles. Mesh colliders with convex hulls will cause collisions with objects that are entirely inside them, whereas ones without will only collide at their surfaces.
It is important to note that “concave” is not the right word to describe a mesh collider without a convex hull in Unity. The convexity of the hull is just a result of how it is calculated—using points rather than faces. Your mesh has to be convex in order for the hull to accurately match its surface. Convex hulls are not affected by holes in meshes.
Concave colliders with volume are a more complicated matter, and not currently supported by Unity. Calculating a concave volume properly requires taking triangles into account rather than just vertices, and thus requires that a mesh not have any holes. This is probably what Joe was thinking of when he asked about holes in your meshes.
Thanks for that very detailed and well written response
That makes sense, and it corresponds with the tests I was doing.
Just before I put an end to this thread… the reason I asked my original question is because I’m currently dealing with the “bullet going through the wall” problem that is often associated with bullet passing through the collider before it registers a collision.
Most of our problems are with the non-convex mesh colliders for the reasons that were just described… changing the meshes to concave is going to be a little tricky, and require making a whole new set of separate meshes.
Before I tell our 3D modeler to make a second simplified version of everything he’s already given me, are there any other ways I could approach this?
You might have luck with this DontGoThroughThings script, but I’ve found that the only reliable way to do bullets is either entirely with raycasting and moving them yourself, or with solid (primitive or convex hull mesh) colliders that are thick enough to guarantee nothing will pass through them in a single physics step.
Ok that’s pretty much what I was expecting. I did have a look at that “DontGoThroughThings” script a while back and it didn’t seem to help. I’ll send it along to our programmer though, he might be able to make more sense of it :roll:
I’ve heard that raycasting is a little computationally heavy, have you found it difficult to balance with an optimal Framerate? If we did go that route are there things we could cut back on?