Previously we handles each table the same. The updated algorithm now has a disjoint set for each traverse anim type, and selectively determines which poly's are reachable based on the link's traverse type connecting them. All left to be done here is making a correct lookup table, which is currently defined as s_traverseAnimTraverseFlags.
Split traverse link creation and updating code from the editor, only alloc traverse table when we are creating them or when we load navmeshes that have them, don't alloc them before the navmesh is built. Also moved the disjoint set data to the editor class so we can cache the results and reuse them later after editing the navmesh post build. Traverse link algorithm now also ignores polys marked unlinked.
* Properly calculate how much we need to offset from the navmesh's edge to account for the ledge span
* Properly check if the edge we are connecting to overhangs our lower link position.
* Check if our ledge span offset causes the link to clip into geometry, and skip linking if so.
* Removed an improper intersection test in 'Editor::connectTileTraverseLinks', which caused many false positives (all issues this fixes, have been fixed with the improved 'traverseLinkInLOS'.
* Removed extraneous 'CanOverlapPoly' check; all links can now overlap poly's without issues if they pass through the 'traverseLinkInLOS' test.
* Only perform offsetting calculation if we have an amount to offset.
* Split 'dtCalcLinkDistance' into 2 functions, one that calculates it and 'dtQuantLinkDistance' that performs the quantization.
* Removed incorrect and experimental code from 'dtNavMesh::connectExtOffMeshLinks', this was to test off-mesh links for MSET 5, but this wasn't the correct approach.
The upper pos needs to be offset forward with at least the agent's radius since for jumps, we don't take the gap between the ledge and navmesh into account.
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.