Day 4

Some, But Not All

So today I continued work on fixing the PolyMeshDetail bug in SharpNav. By updating my process to match Recast’s, I got some polygons to properly add detail and generate a Delaunay hull, but it now seems that some of the other polygons are not generating properly.

Recast’s update added a TriangulateHull method that would simply triangulate a convex polygon in the case that the polygon was small or thin. Since the detail step is doing very little in the example map outside of the two hilly areas off to the side, this fixed one of the four triangles that were being triangulated badly.

As you can see on the bottom left, the addition of a single internal point to a mesh now works just fine, but the one polygon with two internal points has a nice big hole inside of it.

It now appears that adding 0 or 1 internal points to a polygon works fine, but when a polygon is sufficiently large enough or over a detailed enough part of the map and 2 or more internal points need to be added, it doesn’t triangulate properly and might actually stop early with one internal point.

So now that some, but not all of the polygons that were producing errors were fixed, I can scope down the issue to an error in either DelaunayHull or the second half of BuildPolyDetail and only for polygons that require two or more additional internal points.

Now that I’ve scoped it down more, I think I may be able to fix it entirely tomorrow.

Originally published at on December 28, 2014.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.