Get GraphNode's normal?

Hi

The normal is not explicitly stored for any node, however if you have a navmesh/recast graph you can calculate the normal like this:

TriangleMeshNode triNode = node as TriangleMeshNode;
var normal = Vector3.Cross((Vector3)(triNode.GetVertex(1) - triNode.GetVertex(0)), (Vector3)(triNode.GetVertex(2) - triNode.GetVertex(0)));

You may also be interested in some methods on the TriangleMeshNode class, such as ClosestPointOnNode, ClosestPointOnNodeXZ and ContainsPoint.

1 Like