• Articles
  • Api Documentation
Show / Hide Table of Contents
  • AnyPath
    • Graphs
      • Extra
        • Line2D
        • Line3D
        • Triangle
      • HexGrid
        • HexGrid
        • HexGrid.Enumerator
        • HexGridCell
        • HexGridHeuristicProvider
        • HexGridType
      • Line
        • ClosestLineLocationPredicate
        • LineGraph
        • LineGraph.Edge
        • LineGraph.Enumerator
        • LineGraphBuilder
        • LineGraphBuilder.ProtoEdge
        • LineGraphDrawer
        • LineGraphHeuristic
        • LineGraphLocation
        • LineGraphPopulator
        • LineGraphProcessor
        • LineGraphWelder
        • SceneGraph
          • LineGraphNode
          • LineSceneGraph
          • LineSceneGraphEdge
          • SceneGraphNodeEditor
      • NavMesh
        • ClosestNavMeshLocationPredicate
        • CornerAndNormal
        • IUnrolledNavMeshGraphPortal
        • NavMeshGraph
        • NavMeshGraph.EnterCostAndFlags
        • NavMeshGraph.Enumerator
        • NavMeshGraphCorners
        • NavMeshGraphCorners3D
        • NavMeshGraphHeuristic
        • NavMeshGraphLocation
        • NavMeshGraphUnroller
        • NavMeshLineBitmaskMod
        • NavMeshLineMod
        • NavMeshPlaneBitmaskMod
        • NavMeshPlaneMod
        • NavMeshPopulator
        • NavMeshWelder
        • SSFA
        • UnrolledNavMeshGraphPortal
      • Node
        • NodeGraph
        • NodeGraphNode
      • PlatformerGraph
        • ClosestPlatformerGraphLocationPredicate
        • PlatformerGraph
        • PlatformerGraph.Enumerator
        • PlatformerGraphBuilder
        • PlatformerGraphBuilder.ProtoEdge
        • PlatformerGraphDrawer
        • PlatformerGraphHeuristic
        • PlatformerGraphLocation
        • PlatformerGraphPopulator
        • PlatformerGraphProcessor
        • PlatformerGraphWelder
        • SceneGraph
          • PlatformerSceneGraph
          • PlatformerSceneGraphEdge
          • PlatformerSceneGraphNode
          • SceneGraphNodeEditor
      • SquareGrid
        • SquareGrid
        • SquareGrid.Enumerator
        • SquareGridCell
        • SquareGridHeuristicProvider
        • SquareGridHeuristicProviderEightDirectional
        • SquareGridHeuristicProviderManhattanDistance
        • SquareGridType
      • VoxelGrid
        • VoxelGrid
        • VoxelGrid.DirCost
        • VoxelGrid.Enumerator
        • VoxelGridCell
        • VoxelGridDirectionFlags
        • VoxelGridDirectionMod
        • VoxelGridHeuristicProvider
        • VoxelGridHeuristicProviderManhattanDistance
    • Managed
      • ClearFinderFlags
      • FinderExtensions
      • IFinder
      • IOptionReserver<TOption>
      • IOptionValidator<TOption>
      • ImmutableFinderException
      • ManagedDisposeExtensions
      • Results
        • DijkstraResult<TNode>
        • Eval
        • Eval<TOption>
        • MultiEvalResult
        • MultiPathResult<TSeg>
        • Path<TSeg>
        • Path<TOption, TSeg>
    • Native
      • AStarCheapestOption
      • AStarEvalOptionResult
      • AStarEvalResult
      • AStarFindOptionResult
      • AStarFindPathResult
      • AStarOption
      • AStarStops
      • AStar<TNode>
      • ComposedGraph<TGraph, TNode>
      • Edge<TNode>
      • FlagBitmask<TNode>
      • IEdgeMod<TNode>
      • IGraph<TNode>
      • IHeuristicProvider<TNode>
      • INodeFlags
      • IPathProcessor<TNode, TSeg>
      • NativeListWrapper<TSeg>
      • NoEdgeMod<TNode>
      • NoProcessing<TNode>
      • OffsetInfo
      • ReversedGraph<TNode>
      • EdgeMods
        • AdditionalAndExcludeEdges<TNode>
        • AdditionalEdges<TNode>
        • ExcludeEdges<TNode>
        • ExcludeLocations<TNode>
      • Heuristics
        • ALTCompute<TGraph, TNode>
        • ALTSerialization
        • ALT<TNode>
        • LandmarkSelection<TGraph, TNode, TEnumerator>
      • Util
        • IRefComparer<T>
        • NativeMinHeap<T, TComp>
        • NativeRefMinHeap<T, TComp>

Namespace AnyPath.Graphs.PlatformerGraph

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.

Classes

PlatformerGraphBuilder

Utility to construct a platformer graph by connecting vertices by Id instead of index, which is far more convenient when building a custom editor. As an example use case, this class is used to construct the Platformer Graph by the PlatformerSceneGraph.

PlatformerGraphDrawer

Makes it extremely easy to 'draw' a platformer graph. Just add lines/edges and close enough vertices will automatically be joined together.

PlatformerGraphPopulator

Utility to populate PlatformerGraph using Unity's Job system. This can be useful if you have frequent updates and want this process to be as fast as possible and/or on another thread.

PlatformerGraphWelder

Utility to weld close edge endpoints in a platformer graph together. Also contains 'continous' weld methods, which make it extremely easy to just draw a graph and the vertices will be connected together automatically. For managed use of this continious welding, see PlatformerGraphDrawer

Structs

PlatformerGraph

A graph specifically designed for 2D platformer types of games, but can also be used as an advanced waypointing system. What makes this graph unique is that the edges themselves play the main part, not the nodes they connect. This allows for fluid positions anywhere on an edge.

Added functionality since v1.1 is that the graph can now be pre-allocated and then populated from within jobs.

PlatformerGraph.Enumerator

Structure that enumerates all edges/locations in the graph. This can be used to construct ALT heuristics.

PlatformerGraphBuilder.ProtoEdge

Prototype of an edge.

PlatformerGraphHeuristic

Simple heuristic provider for PlatformerGraph

PlatformerGraphLocation

Represents a location on the platformer graph. A location can be retrieved by calling the Raycast or Closest functions on the PlatformerGraph. A location can be used as a start/stop/goal in a path request. This same struct is also used as the path segment type after processing. This is done because the flags may contain information your agent needs while navigating through your world, and for performance reasons because a big chunk of the path can just be memcpyd'.

PlatformerGraphProcessor

Processes the raw A* result for a request on the platformer graph. This processing ensures that the resulting segments all point in the correct direction.

Delegates

ClosestPlatformerGraphLocationPredicate

In This Article
Back to top Generated by DocFX