A* Pathfinding Project  3.0.9
The A* Pathfinding Project for Unity
ConstantPath Class Reference

Finds all nodes within a specified distance from the start. More...

+ Inheritance diagram for ConstantPath:
+ Collaboration diagram for ConstantPath:

List of all members.

Public Member Functions

 ConstantPath (Vector3 start, OnPathDelegate callbackDelegate)  Creates a new ConstantPath starting from the specified point.
 ConstantPath (Vector3 start, int maxGScore, OnPathDelegate callbackDelegate)  Creates a new ConstantPath starting from the specified point.
override void Reset (Vector3 start, Vector3 end, OnPathDelegate callbackDelegate, bool reset)  Reset the path to default values.
override void Initialize ()  Initializes the path.
override float CalculateStep (float remainingFrameTime)  Calculates the path until completed or until the function duration has exceeded remainingFrameTime.

Public Variables

List< NodeallNodes = new List<Node>()  Contains all nodes the path found.
PathEndingCondition endingCondition  Controls when the path should terminate.

Detailed Description

Finds all nodes within a specified distance from the start.

This class will search outwards from the start point and find all nodes which it costs less than ConstantPath::maxGScore to reach, this is usually the same as the distance to them multiplied with 100

The path can be called like:

//Here you create a new path and set how far it should search. Null is for the callback, but the seeker will handle that
ConstantPath cpath = new ConstantPath(transform.position,2000,null);
//Set the seeker to search for the path (where mySeeker is a variable referencing a Seeker component)
mySeeker.StartPath (cpath,myCallbackFunction);

Then when getting the callback, all nodes will be stored in the variable ConstantPath::allNodes (remember that you need to cast it from Path to ConstantPath first to get the variable).

Note:
Due to the nature of the system, there might be duplicates of some nodes in the array.

This list will be sorted by G score (cost/distance to reach the node), however only the last duplicate of a node in the list is guaranteed to be sorted in this way.

constantPath.png
A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here

Constructor & Destructor Documentation

ConstantPath ( Vector3  start,
OnPathDelegate  callbackDelegate 
)

Creates a new ConstantPath starting from the specified point.

Parameters:
startFrom where the path will be started from (the closest node to that point will be used)
callbackDelegateWill be called when the path has completed, leave this to null if you use a Seeker to handle calls Searching will be stopped when a node has a G score (cost to reach it) higher than what's specified as default value in Pathfinding::EndingConditionDistance
ConstantPath ( Vector3  start,
int  maxGScore,
OnPathDelegate  callbackDelegate 
)

Creates a new ConstantPath starting from the specified point.

Parameters:
startFrom where the path will be started from (the closest node to that point will be used)
maxGScoreSearching will be stopped when a node has a G score greater than this
callbackDelegateWill be called when the path has completed, leave this to null if you use a Seeker to handle calls

Searching will be stopped when a node has a G score (cost to reach it) greater than maxGScore


Member Function Documentation

override float CalculateStep ( float  remainingFrameTime) [virtual]

Calculates the path until completed or until the function duration has exceeded remainingFrameTime.

Usually a check is only done every 500 nodes if the time has exceeded remainingFrameTime.

Reimplemented from Path.

override void Initialize ( ) [virtual]

Initializes the path.

Sets up the open list and adds the first node to it

Reimplemented from Path.

override void Reset ( Vector3  start,
Vector3  end,
OnPathDelegate  callbackDelegate,
bool  reset 
) [virtual]

Reset the path to default values.

Clears the allNodes list.

Note:
This does not reset the endingCondition.

Also sets heuristic to Heuristic.None as it is the default value for this path type

Reimplemented from Path.


Member Data Documentation

List<Node> allNodes = new List<Node>()

Contains all nodes the path found.

Note:
Due to the nature of the system, there might be duplicates of some nodes in the array. This list will be sorted by G score (cost/distance to reach the node), however only the last duplicate of a node in the list is guaranteed to be sorted in this way.

Controls when the path should terminate.

This is set up automatically in the constructor to an instance of the Pathfinding::EndingConditionDistance class with a maxGScore is specified in the constructor. If you want to use another ending condition.

See also:
Pathfinding::PathEndingCondition for examples

The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Properties