Hey. If you use MeshParts for your level’s geometry then you’re probably familiar with the problem of collision meshes being unusable:
One common way to get around this limitation is by importing the mesh as a bunch of wedges! While there are already plugins that do this (.OBJ Importer, by TheNexusAvenger and .obj -> wedges, by ThanksRoBama, they have some problems:
- .OBJ Importer doesn’t support meshes that have faces with more than three vertices (i.e. they have to be triangulated before exporting).
- .OBJ Importer renders triangles incorrectly. Both also don’t take face normals into account, so the edges are offset slightly. This creates gaps between triangles.
- Both don’t support non-uniform scaling. .obj ->wedges doesn’t support scaling at all.
- Both require you to copy-paste the .obj file instead of being able to import them directly.
- Both render the mesh facing the wrong way (rotated by 180 degrees in the Y-Axis).
- Both don’t allow you do configure the “thickness” of the resulting mesh.
To solve these problems, I wrote this plugin! Here’s a demo:
Some stuff you should know when using this plugin:
- Do not use these for very detailed meshes! This is really only meant for stuff like terrain. If you want to use these for structures, then I would recommend that you use a low-detailed version of the structure when generating the collision parts. The number of wedges that the plugin will generate will be listed in the preview.
- The parts rendered by this should be set to be rendered invisible since you really only care about the collision, not the appearance. I only rendered them as visible for demonstration.
- For slow computers, it may appear to hang when you’re trying to import a very small (size-wise) mesh that has a lot of triangles.
- If you’re using Blender and you’re used to exporting meshes as .FBX instead of .OBJ, you don’t need to set the export scale for .OBJs to 0.01 so that 1 unit = 1 stud.
- Set the shell thickness (the thickness of each face) to as thick as you can before the wedges start poking through the surface of the mesh too much.