Search Unity

Mesh Collider Partially Colliding on Large Terrain Mesh

Discussion in 'Physics' started by ede0m, Jan 20, 2021.

  1. ede0m

    ede0m

    Joined:
    Dec 12, 2020
    Posts:
    7
    Hello!

    I have made a high vert "dense" mesh in blender that I use as terrain in my unity project. I have successfully used a mesh of about 1 million by simply checking "generate mesh collider" on the model in the editor and applying this setting.

    However, when I make the mesh more dense and increase the number of vertices to 4 million, then follow the same import process, only part of the generated mesh collider seems to be working. That is, my character (with rigidbody) can stand on this terrain in certain spots, but as it moves, it will suddenly fall through the mesh as if the mesh collider is missing huge sections of the mesh. I have triple checked that the mesh collider is using the same mesh that is rendered.

    Intuitively, it seems like the mesh collider is not lined up with the mesh. Is there a way I can verify this? I have looked around on he documentation, but haven't noticed any threshold for number of vertices with non-convex mesh colliders.

    Another thing worth noting is that when importing the mesh from blender to Unity, the scale is set to 100 for some reason. This scaling did not seem to cause problems with the "smaller" 1m vert mesh.

    Any insight is much appreciated!
     
  2. ede0m

    ede0m

    Joined:
    Dec 12, 2020
    Posts:
    7
    To add some more information.. I noticed that collision is only being applied in the positive quadrant of the XZ plane. That is, as soon as the character moves into -x, or -z position quad, it will begin to fall. I don't have much of an inclination as to why this is happening. Sliding the whole terrain into the positive quadrant seems to crash Unity.