- Home /
Unity creates a cube like collider when selecting "convex" for a complete different looking mesh created with MeshFilter. How can I fix this?
,Hey guys,
I'm creating a Mesh out of a curve of points and a straight line of points (both the curve and the line have the same number of points) via script.
I need the mesh created as a trigger in the end, but I can't use it in a correct way, since the mesh has to be convex to be a trigger (for a mesh collider). When I tick the option "convex" in the inspector of that collider it creates a box like collider which I can't use for the precise collision i need.
Is there any way to get a convex mesh in the form (or very similar) I need?
More Information for interested People: I connect all vertices in a rectangle like manner: First I connect the top left point, the bottom left point and the point right next to the bottom one. After that I connect both bottom points with the second point of the top points. It goes on like that. The curve in the top is interpolated through the the red points.
Answer by Leon-VB · Dec 16, 2021 at 11:55 AM
I found a solution myself: Since my mesh was flat, it wasn't convex by itself and unity has a weird way to create a convex new mesh out of that (for the collider). I just copied the mesh and moved it a bit under the initial mesh. Then I combined the meshes. Since the mesh isn't flat anymore, unity will create a convex collider, that fits exactly to the mesh.