Namespace AnyPath.Graphs.PlatformerGraph
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.