Instead of looping over and passing in neighbor tiles, look at which side our link start point is, and look for a neighbor tile on that side. This generates very clean traverse links, and also fixes the issue where the ai walks towards the opposite direction of where the target is before initiating a jump, as previously, jump links would be generated on any edge it finds. Also changed 'Editor::createTraverseLinks' to make it generate both external and internal links; starting with external ones, and filling internal gaps on the 2nd run before moving on to the next start tile.
Now connect to neighbor tiles (still work in progress). Also moved poly overlap and raycast logic to separate functions. The raycast checks are now performed as a very last step as previously we would raycast, and then determine we can't establish the link because the traverse type was NULL or the distance was too great, which both could be checked before the raycast and are also a lot cheaper to check. Changing the order of checks significantly improved the performance.
Also fixed a bug in dtCalcLinkDistance, if the number exceeds 2550.f, it would overflow and cause links to be a lot larger. If the value exceeds the number now, it would return 0 and no link will be established.
MSET 5 uses the default Recast & Detour tile and poly bit configuration. MSET 7 or higher uses a different configuration to allow building navmeshes for the size's of Apex Legends maps.
-1 is used by the game, and means only traverse links on the same polygon island. This has now been properly implemented. Also fixed a crash when enabling the "Traverse Links" Detour render option with no navmesh loaded.
We need to create the disjoint sets first, then build all traverse links, and finally from there determine all unlinked poly's and remap disjoint sets. Doing this prior to traverse link generation causes polygons that are only linked through traverse links to remain tagged as unlinked.
Only render the cross at the start as the reverse link will render the 2nd one. Else we render 4 crosses. Also made the alpha of the line around 50%, since we render the forward and reverse link, it will render with 100% opacity, if the reverse link is missing, the crosses will disappear and the line will only render at 50% opacity to make it more clear something is wrong.
Technically the bmin, bmax and side need to be calculated properly, but at the same time, we currently only do internal links, so it shouldn't matter a lot if at all.
If a traverse type can't overlap, but does overlap with a polygon, then don't add it. This fixes the issue where the jump links run flat over the navmesh surface.
Need at least 2 links, one for the reverse link. Not adhering to this results in NULL reverse links which causes incorrect behavior in the renderer and in-game.
Traverse links should be build after the disjoint poly groups are created, but before the traverse tables are created. Previously, we created traverse links before disjoint poly groups causing isolated poly islands to be grouped under the same id.
Traversing now works in-game, but there's still work needed to polish the algorithm and creating a proper lookup for jump types as currently only 1 jump type is supported.