public static BuildFunnelCorridor ( INavmesh graph, List |
||
graph | INavmesh | |
path | List |
|
startIndex | int | |
endIndex | int | |
left | List |
|
right | List |
|
return | void |
public static void BuildFunnelCorridor (INavmesh graph, List<GraphNode> path, int startIndex, int endIndex, List<Vector3> left, List<Vector3> right) {
if (graph == null) {
Debug.LogError ("Couldn't cast graph to the appropriate type (graph isn't a Navmesh type graph, it doesn't implement the INavmesh interface)");
return;
}
for (int i=startIndex;i<endIndex;i++) {
//Find the connection between the nodes
TriangleMeshNode n1 = path[i] as TriangleMeshNode;
TriangleMeshNode n2 = path[i+1] as TriangleMeshNode;
int a;
bool search = true;
for (a=0;a<3;a++) {
for (int b=0;b<3;b++) {
if (n1.GetVertexIndex(a) == n2.GetVertexIndex((b+1)%3) && n1.GetVertexIndex((a+1)%3) == n2.GetVertexIndex(b)) {
search = false;
break;
}
}
if (!search) break;
}
if (a == 3) {
left.Add ((Vector3)n1.position);
right.Add ((Vector3)n1.position);
left.Add ((Vector3)n2.position);
right.Add ((Vector3)n2.position);
} else {
left.Add ((Vector3)n1.GetVertex(a));
right.Add ((Vector3)n1.GetVertex((a+1)%3));
}
}
}
NavMeshGraph::BuildFunnelCorridor ( List |
public void BuildFunnelCorridor(List <GraphNode> path, int startIndex, int endIndex, List <Vector3> left, List <Vector3> right) { NavMeshGraph.BuildFunnelCorridor(this, path, startIndex, endIndex, left, right); }