Hello,
I’m trying to fill the area of non convex objects. I have the points that define their contours but I don’t know how to fill their area. Currently, I have a mesh collider and a line render. The line renderer is used just to drawn the contour using the points. The mesh uses the same set of points to create a collider contour to detect collisions.
The objects have similar shapes to the examples below:
This is how I’m creating the mesh:
objRenderer.positionCount = conePoints.Length;
objRenderer.SetPositions(conePoints);
objRenderer.BakeMesh(mesh, true);
Vector2[] points = new Vector2[mesh.uv.Length];
for (int i = 0; i < mesh.vertices.Length; i++)
{
points[i] = new Vector2(mesh.vertices[i].x, mesh.vertices[i].z);
}
mesh.uv = points;
objMeshCollider.sharedMesh = mesh;
objMeshCollider.enabled = true;
objMeshFilter.mesh = mesh;
I’ve tried using MeshRenderer but it does not fill the area of the object. It fills the area of the Mesh which is the contour.
Any help would be much appreciated