Hi!
I’m writing a custom path post processing algorithm (MonoModifier), and i’m running into an issue.
One of the steps of the algorithm needs to know which corners two adjacent GraphNodes share. The code’s pretty straight forward:
// n0 and n1 are adjacent corners in the graph sent to Apply
private static void FindSharedCorners(RecastGraph graph, TriangleMeshNode n0, TriangleMeshNode n1, List<Vector3> result) {
result.Clear();
if (n0.v0 == n1.v0 || n0.v0 == n1.v1 || n0.v0 == n1.v2) {
result.Add((Vector3) graph.GetVertex(n0.v0));
}
if (n0.v1 == n1.v0 || n0.v1 == n1.v1 || n0.v1 == n1.v2) {
result.Add((Vector3) graph.GetVertex(n0.v1));
}
if (n0.v2 == n1.v0 || n0.v2 == n1.v1 || n0.v2 == n1.v2) {
result.Add((Vector3) graph.GetVertex(n0.v2));
}
}
The problem here is that if I generate the Recast Graph with tiles, I sometimes get no shared corners. Checking closer, it seems like the TriangleMeshNodes have corners with the same positions, but different indices.
Is that intentional? Does tiled graphs have several indices for the same vertexes? Or is that something that can always happen, and I’m only seeing in tiled graphs?
I want to avoid comparing the node’s positions (this modifier runs a lot), but right now it seems like I have to do that.