public static void FillPolyMesh(int numVerts, PolyMesh mesh) { numVerts = Mathf.Max(numVerts, 3); var positions = Pool <List <Vector3> > .Spawn(); positions.Clear(); try { Quaternion rot = Quaternion.AngleAxis(360f / numVerts, -Vector3.forward); Vector3 radial = Vector3.right; positions.Add(radial); for (int i = 1; i < numVerts; i++) { radial = rot * radial; positions.Add(radial); } var indices = Values.Range(0, numVerts); var polygon = new Polygon() { mesh = mesh, verts = indices.ToList() }; mesh.Fill(positions, polygon); } finally { positions.Clear(); Pool <List <Vector3> > .Recycle(positions); } }
public static void FillPolyMesh(PolyMesh mesh) { mesh.Fill(Positions, Polygons, PolyMesh.PositionMode.Local); }