- Home /
The question is answered, right answer was accepted
Mesh Collision system seems to be buggy.
Mesh Colliders seem inaccurate in producing a proper collision mesh around an object. In some cases a corner of a wall can be the death of a player as at the right position a person can push their player through the mesh. If words are to describe the collider its that it seems thin and doesn't take well to corners or edges. Are there any ways to adjust a Mesh Collider using additional scripting or adjust the players Character Controller so that a positive response between the two colliders are met.
Answer by AlwaysSunny · Feb 28, 2015 at 06:15 AM
Consider increasing the vertex density of your meshes, and use a fairly consistent density of vertices in all your physically interactive models. I've found this can add to the simulation's stability. Where possible, use simple shapes for collision meshes and tailor their complexity to meet the requirements of your game mechanics, while being as simple as possible. Avoid concave meshes wherever possible.
The object I am using is the inside of a cave, anyway I could optimize the mesh to fix the error? I have tried increasing the vertex density but the problem still exist due to the object being mostly concave. Luckily the increased vertex density method fixed the issue with the other objects and now the only the cave is experiencing issues.
If you're not already doing so, you should definitely consider splitting any complex meshes into multiple parts.
Someone correct me if I'm way off here, but it's my understanding that simpler, more "functionality conscious" meshes work best as colliders. $$anonymous$$eshes with consistent verts-per-sqr-meter, with greater density in "problem" areas as needed, work best.
If so, it stands to reason that dividing a complex mesh into many simpler meshes would produce better results. This "divide complex stuff" practice is beneficial in other areas of game development too, particularly optimization.
Thanks Ive been doing that with my overworld and in my demo world to cut render time but didnt think it was also helping with mesh colliders. I thought that the cave was simple enough for the mesh collider to work but I guess not and that seems like the most appropriate answer to this problem. Thanks for the reply!