Graph Types
AnyPath comes with a built in set of graphs that can be used directly, or serve as a starting point for customizing to your specific needs.
Navigation Mesh
Navigation mesh with the following features:
Arbitrarily curved worlds.
Path straightening (string pulling) which also works on curved worlds.
Realtime steering target positions with string pulling, which can be useful in conjunction with obstacle avoidance (which is not included)
Constructed from a set of vertices and triangles, so compatible with Unity's NavMesh generation, your own procedure or any other format (.obj, .fbx etc...)
Smart navigation to exact positions within triangles, produces believable paths even with messy triangulation
Per triangle cost
Per triangle flags for excluding certain areas from a query
Optimized raycast queries on the mesh, useful for knowing where the agent's location on the mesh is or collision detection.
Also suitable for 2D navigation meshes in any plane (XY, XZ) or rotation for that matter.
New (v1.1): Fast welding of vertices together using Unity's Job system, useful for frequent updates
New (v1.1): Graph can be pre-allocated and then populated and calculated from within a burst compiled job, useful for frequent updates
New (v1.1): AABB triangle overlap queries, useful for cutting out triangles in a given area
See AnyPath.Graphs.NavMesh form more information.
Line Graph
A graph that describes 3D edges/lines between points. Very similar to AnyPath.Graphs.PlatformerGraph, but in 3D. Note that the words edge and line are used interchangeably throughout the documentation.
Features:
Paths are calculated from arbitrary locations on edges to any position on another edge. So your pathfinding query doesn't have to start and end at the exact node positions but can be anywhere in between.
Edges themselves can have additional properties, like flags and additional cost to discourage paths along certain edges.
Edges can be made 'unwalkable' without rebuilding the entire graph by assigning a cost of infinity to an edge.
Closest edge queries from any position in space. If an agent moved away from an edge, it can recover it's location on the graph using these queries.
Edges can be directed and undirected.
Edges can have a user assigned Id to easily map back to MonoBehaviour scripts
The resulting path is a list of segments containing all the information, the exact enter and exit positions on each edge and it's flags, so once you have a path, there doesn't have to be any need to do additional raycasting or collision detection (with the static world at least).
AnyPath.Graphs.Line.SceneGraph, a Line Graph Scene Editor tool to design a line graph inside of your scene.
See AnyPath.Graphs.Line for more information.
Platformer Graph
A graph specifically designed for 2D platformer types of games, but can also be used as a top down 'roads' system. What makes this graph unique is that the edges themselves play the main part, not the nodes they connect.
Features:
Edges can be tought of as surfaces where an agent can walk for platformer type games, or as 'roads' for top down games.
Edges themselves can have additional properties. For example, there can be a directed jump edge between nodes with a higher cost associated with them, connecting two surface edges. Another example could be a fall edge, or fly edges.
Edges can be made 'unwalkable' without rebuilding the entire graph by assigning a cost of infinity to an edge.
Paths are calculated from arbitrary locations on edges to any position on another edge. So your pathfinding query doesn't have to start and end at the exact node positions but can be anywhere in between.
Optimized raycast queries for knowing at which edge/road the agent currently is located. For example, raycasting down to find the surface the agent walks on.
Closest edge queries from any position in space. If an agent moved away from an edge, it can recover it's location on the graph using these queries.
The resulting path is a list of segments containing all the information, the exact enter and exit positions on each edge and it's flags, so once you have a path, there doesn't have to be any need to do additional raycasting or collision detection (with the static world at least).
Directed and undirected edges
Per edge cost and flags for discouraging or excluding certain areas
New (v1.2): Id's per edge, allowing for easy mapping back to MonoBehaviour script via GetInstanceId.
New (v1.2): Closest edge query now accepts a delegate to check for obstructions in the line of sight.
New (v1.1): Graph can be pre-allocated and populated from within a burst compiled job. Useful if you need fast, frequent updates.
New (v1.1): Fast welding of vertices together using Unity's Job system, useful for frequent updates
New (v1.1): Graph can be drawn using the PlatformerGraphDrawer with automatic joining of vertices, making it extremely easy to generate a graph on the fly
AnyPath.Graphs.PlatformerGraph.SceneGraph, a Platformer Graph Scene Editor tool to design a platformer graph inside of your scene.
See AnyPath.Graphs.PlatformerGraph for more information.
Square Grid
A simple square grid structure with support for per tile cost and four or eight neighbours per tile.
See AnyPath.Graphs.SquareGrid for more information.
Voxel Grid
A 3D voxel grid that's easily extendable with out of the box support for various movement types.
- Possible movement directions can be customized. E.g. six directions, 26 directions or any variation.
- Movement can be free but gravity can also be simulated using custom movement types.
- Every cell can have flags that can influence per pathfinding request behaviour.
- By default open cells are navigatable, but this behaviour can be inverted.
- Simple implementation that can function as a solid foundation for more complicated use cases.
See AnyPath.Graphs.VoxelGrid for more information.
Hexagonal Grid
A simple hexagonal grid structure with support for per tile cost.
See AnyPath.Graphs.HexGrid for more information.
Node Graph
A simple graph structure that connects vertices/nodes together in 3D space. Nodes can have additional cost and flags associated with them. This is a good option if you only have fixed nodes in space and don't require agents to be able to find paths "in between" nodes. Agents should also keep track of the node they are currently at themselves.
See AnyPath.Graphs.Node for more information.