• 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>

Class 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

Inheritance
object
PlatformerGraphWelder
Namespace: AnyPath.Graphs.PlatformerGraph
Assembly: AnyPath.dll
Syntax
public class PlatformerGraphWelder

Constructors

PlatformerGraphWelder()

Declaration
public PlatformerGraphWelder()

Methods

ContinuousWeld(float2, float2, float, int, List<float2>, List<Edge>, Dictionary<int2, int>, float)

Provides an easy way to generate vertices and edges for a platformer graph. You can just 'draw' lines from point to point and if points are close enough to each other, their shared edges will merge and thus be connected in the graph. For most easy of use, use the provided PlatformerGraphDrawer

Declaration
public static void ContinuousWeld(float2 a, float2 b, float enterCost, int flags, List<float2> vertices, List<PlatformerGraph.Edge> edges, Dictionary<int2, int> buckets, float thresholdMultiplier = 100)
Parameters
Type Name Description
float2 a
float2 b
float enterCost
int flags
List<float2> vertices
List<PlatformerGraph.Edge> edges
Dictionary<int2, int> buckets
float thresholdMultiplier

ContinuousWeld(float2, float2, float, int, NativeList<float2>, NativeList<Edge>, NativeHashMap<int2, int>, float)

Provides an easy way to generate vertices and edges for a platformer graph. You can just 'draw' lines from point to point and if points are close enough to each other, their shared edges will merge and thus be connected in the graph.

Declaration
public static void ContinuousWeld(float2 a, float2 b, float enterCost, int flags, NativeList<float2> vertices, NativeList<PlatformerGraph.Edge> edges, NativeHashMap<int2, int> buckets, float thresholdMultiplier = 100)
Parameters
Type Name Description
float2 a

Starting position of the edge

float2 b

Ending position of the edge

float enterCost

Optional extra cost associated with traversing this edge in a pathfinding query

int flags

Optional flags associated with traversing this edge in a pathfinding query

NativeList<float2> vertices

List of vertices to append to, keep around for as long as you're continiously welding a graph.

Once your welding is finished, you can pass in this list to populate the PlatformerGraph

NativeList<PlatformerGraph.Edge> edges

The list of edges to append to, keep around for as long as you're continiously welding a graph.

Once your welding is finished, you can pass in this list to populate the PlatformerGraph as either directed or undirected edges.

NativeHashMap<int2, int> buckets

Container that's neccessary for the algorithm to quickly find if there is already a vertex occupying a certain location. Allocate and/or make sure to clear this when you begin your first weld and keep it around for as long as you're continuously welding a graph

float thresholdMultiplier

One divided by the maximum (manhattan) distance vertices can have in order to join them. For example, if you want to weld vertices that are closer than approx 0.1, pass in 1 divided by 0.1. Note that for performance reasons, this is the manhattan distance

Remarks

This method is agnostic about the edges being undirected or directed. This is determined when you populate the PlatformerGraph. You can continuously weld and use two separate lists for undirected and directed edges if you desire. As long as the vertex list and buckets remain the same the result will be valid.

Burst compatible so can run in a job

ScheduleWeld(NativeList<float2>, NativeArray<Edge>, NativeArray<Edge>, float, JobHandle)

Finds vertices that are close together in a graph and welds them together. Depending on your mesh this may or may not be neccessary for correct pathfinding, as neighbouring triangles need to share the same vertices.

Declaration
public static JobHandle ScheduleWeld(NativeList<float2> inOutVertices, NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges, NativeArray<PlatformerGraph.Edge> inOutDirectedEdges = default, float weldThreshold = 0.001, JobHandle dependsOn = default)
Parameters
Type Name Description
NativeList<float2> inOutVertices

The vertices to weld together. This list contains the modified vertices afterwards.

NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges

The undirected edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no undirected edges.

NativeArray<PlatformerGraph.Edge> inOutDirectedEdges

The directed edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no directed edges

float weldThreshold

Distance below which two vertices will be welded together

JobHandle dependsOn

Optional job dependency for the scheduled job

Returns
Type Description
JobHandle
Remarks

This method schedules a burst compiled job doing the work and can be run on another thread.

ScheduleWeld(NativeList<float2>, NativeArray<Edge>, NativeArray<Edge>, NativeList<float2>, float, JobHandle)

Finds vertices that are close together in a mesh and welds them together. Depending on your graph this may or may not be neccessary for correct pathfinding, as neighbouring edges need to share the same vertices.

Declaration
public static JobHandle ScheduleWeld(NativeList<float2> inVertices, NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges, NativeArray<PlatformerGraph.Edge> inOutDirectedEdges, NativeList<float2> outVertices, float weldThreshold = 0.001, JobHandle dependsOn = default)
Parameters
Type Name Description
NativeList<float2> inVertices

The vertices to weld together.

NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges

The undirected edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no undirected edges.

NativeArray<PlatformerGraph.Edge> inOutDirectedEdges

The directed edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no directed edges

NativeList<float2> outVertices

List to store the output vertices in, this list should be cleared beforehand

float weldThreshold

Distance below which two vertices will be welded together

JobHandle dependsOn

Optional job dependency for the scheduled job

Returns
Type Description
JobHandle
Remarks

This method schedules a burst compiled job doing the work and can be run on another thread.

Weld(List<float2>, List<Edge>, List<Edge>, List<float2>, float)

Finds vertices that are close together in a graph and welds them together. Depending on your hraph this may or may not be neccessary for correct pathfinding, as neighbouring edges need to share the same vertices.

Declaration
public static void Weld(List<float2> inVertices, List<PlatformerGraph.Edge> inOutUndirectedEdges, List<PlatformerGraph.Edge> inOutDirectedEdges, List<float2> outVertices, float weldThreshold = 0.001)
Parameters
Type Name Description
List<float2> inVertices

Original vertices of the graph

List<PlatformerGraph.Edge> inOutUndirectedEdges

The undirected edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no undirected edges.

List<PlatformerGraph.Edge> inOutDirectedEdges

The directed edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no directed edges

List<float2> outVertices

The new unique vertices of the welded mesh, use in conjunction with inOutIndices

float weldThreshold

Distance below which two vertices will be welded together

Remarks

For best performance, use the native overloads as they can utilize Unity's burst compiler for significant speed gains

Weld(List<float2>, List<Edge>, List<Edge>, float)

Finds vertices that are close together in a graph and welds them together in place. Depending on your hraph this may or may not be neccessary for correct pathfinding, as neighbouring edges need to share the same vertices.

Declaration
public static void Weld(List<float2> inOutVertices, List<PlatformerGraph.Edge> inOutUndirectedEdges, List<PlatformerGraph.Edge> inOutDirectedEdges, float weldThreshold = 0.001)
Parameters
Type Name Description
List<float2> inOutVertices

The vertices to weld together. This list contains the modified vertices afterwards.

List<PlatformerGraph.Edge> inOutUndirectedEdges

The undirected edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no undirected edges.

List<PlatformerGraph.Edge> inOutDirectedEdges

The directed edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no directed edges

float weldThreshold

Distance below which two vertices will be welded together

Remarks

For best performance, use the native overloads as they can utilize Unity's burst compiler for significant speed gains

Weld(NativeArray<float2>, NativeArray<Edge>, NativeArray<Edge>, NativeList<float2>, NativeHashMap<int2, int>, NativeHashMap<int, int>, float)

Finds vertices that are close together in a graph and welds them together. Depending on your graph this may or may not be neccessary for correct pathfinding, as neighbouring edges need to share the same vertices.

Declaration
public static void Weld(NativeArray<float2> inVertices, NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges, NativeArray<PlatformerGraph.Edge> inOutDirectedEdges, NativeList<float2> outVertices, NativeHashMap<int2, int> buckets, NativeHashMap<int, int> shiftedIndices, float weldThreshold = 0.001)
Parameters
Type Name Description
NativeArray<float2> inVertices

Original vertices of the graph

NativeArray<PlatformerGraph.Edge> inOutUndirectedEdges

The undirected edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no undirected edges.

NativeArray<PlatformerGraph.Edge> inOutDirectedEdges

The directed edges. This array is modified in place and will contain the new edges afterwards. Use default if you have no directed edges

NativeList<float2> outVertices

The new unique vertices of the welded mesh. This list should be cleraed beforehand

NativeHashMap<int2, int> buckets

A temporary container used by the algorithm, this list should be cleraed beforehand

NativeHashMap<int, int> shiftedIndices

A temporary container used by the algorithm

float weldThreshold

Distance below which two vertices will be welded together

Remarks

This method can be used inside a burst compiled job

Extension Methods

FinderExtensions.AddOption<T, TNode, TOption>(T, TOption, TNode, TNode)
FinderExtensions.AddOptions<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRange<T, TNode, TOption>(T, IEnumerable<TOption>, TNode, Func<TOption, TNode>)
FinderExtensions.AddRequest<T, TNode>(T, TNode, TNode)
FinderExtensions.AddRequests<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.AddStop<T, TNode>(T, TNode)
FinderExtensions.AddStops<T, TNode>(T, IEnumerable<TNode>)
FinderExtensions.SetComparer<T, TOption>(T, IComparer<TOption>)
FinderExtensions.SetEdgeMod<T, TMod>(T, TMod)
FinderExtensions.SetGraph<T, TGraph>(T, TGraph)
FinderExtensions.SetHeuristicProvider<T, TH>(T, TH)
FinderExtensions.SetPathProcessor<T, TProc>(T, TProc)
FinderExtensions.SetReserver<T, TOption>(T, IOptionReserver<TOption>)
FinderExtensions.SetStartAndGoal<T, TNode>(T, TNode, TNode)
FinderExtensions.SetValidator<T, TOption>(T, IOptionValidator<TOption>)
In This Article
Back to top Generated by DocFX