Vixen
02b45cc4
csharp
public static class NavMeshDebugDraw

Draws a navmesh, a path or a crowd into DebugDraw.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A navmesh is a derived thing that nothing renders, so without this the only way to find out that a bake went wrong is that a path did — and a path failing tells you almost nothing about why. Seeing the polygons is the difference between "the agent will not go through the doorway" and "the doorway is a centimetre narrower than the agent radius".

Lines rather than filled triangles, because that is what DebugDraw has and because a wireframe over the level is more readable than a translucent surface anyway: the thing being checked is usually where an edge is, not what colour a face is.

Every interior edge is drawn once, by drawing it only from the polygon with the lower reference. Drawing both sides doubles the line count for no visible difference and makes the shared edges brighter than the walls, which is the wrong way round.

Methods (5)

  • public static void DrawMesh(DebugDraw draw, NavMesh mesh, NavMeshDrawStyle style = default(NavMeshDrawStyle), NavQueryFilter? filter = null, float seconds = 0)

    Draws every polygon of a mesh.

  • public static void DrawDetail(DebugDraw draw, NavMesh mesh, Color4 colour, float lift = 0.05, float seconds = 0)

    Draws the sampled ground under every polygon, as its triangles.

  • public static void DrawCorridor(DebugDraw draw, NavMesh mesh, ReadOnlySpan<NavPolyRef> corridor, Color4 colour, float lift = 0.06, float seconds = 0)

    Draws the polygons of a corridor, as their outlines.

  • public static void DrawPath(DebugDraw draw, ReadOnlySpan<NavPathPoint> path, Color4 colour, float lift = 0.1, float seconds = 0)

    Draws a straight path as a polyline, with a tick at every corner.

  • public static void DrawCrowd(DebugDraw draw, Crowd crowd, float seconds = 0)

    Draws every agent of a crowd: its circle, where it is going, and how fast.

Used by (1)

  • NavMeshDebugDrawTestsVixen.Navigation.Tests