A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
PointGraph Class Reference

Basic point graph. More...

+ Inheritance diagram for PointGraph:
+ Collaboration diagram for PointGraph:

Public Member Functions

void AddChildren (ref int c, Transform tr)
 Recursively adds childrens of a transform as nodes.
 
void DeSerializeNodes (Node[] nodes, AstarSerializer serializer)
 
void DeSerializeSettings (AstarSerializer serializer)
 
bool IsValidConnection (Node a, Node b, out float dist)
 Returns if the connection between a and b is valid.
 
override void Scan ()
 Scans the graph, called from AstarPath.Scan Override this function to implement custom scanning logic
 
void SerializeNodes (Node[] nodes, AstarSerializer serializer)
 
void SerializeSettings (AstarSerializer serializer)
 
void UpdateArea (GraphUpdateObject guo)
 Updates an area in the list graph.
 
- Public Member Functions inherited from NavGraph
virtual void Awake ()
 This will be called on the same time as Awake on the gameObject which the AstarPath script is attached to.
 
virtual Node[] CreateNodes (int number)
 Creates a number of nodes with the correct type for the graph.
 
virtual void DeserializeExtraInfo (byte[] bytes)
 Deserializes graph type specific node data.
 
NNInfo GetNearest (Vector3 position)
 Returns the nearest node to a position using the default NNConstraint.
 
NNInfo GetNearest (Vector3 position, NNConstraint constraint)
 Returns the nearest node to a position using the specified NNConstraint.
 
virtual NNInfo GetNearest (Vector3 position, NNConstraint constraint, Node hint)
 Returns the nearest node to a position using the specified NNConstraint.
 
virtual NNInfo GetNearestForce (Vector3 position, NNConstraint constraint)
 Returns the nearest node to a position using the specified constraint.
 
bool InSearchTree (Node node, Path path)
 Returns if the node is in the search tree of the path.
 
virtual Color NodeColor (Node node, NodeRunData data)
 
virtual void OnDestroy ()
 Function for cleaning up references.
 
virtual void OnDrawGizmos (bool drawNodes)
 
virtual void PostDeserialization ()
 Called after all deserialization has been done for all graphs.
 
virtual void RelocateNodes (Matrix4x4 oldMatrix, Matrix4x4 newMatrix)
 Relocates the nodes in this graph.
 
void SafeOnDestroy ()
 SafeOnDestroy should be used when there is a risk that the pathfinding is searching through this graph when called
 
void ScanGraph ()
 Consider using AstarPath.Scan () instead since this function might screw things up if there is more than one graph.
 
virtual byte[] SerializeExtraInfo ()
 Serializes graph type specific node data.
 
- Public Member Functions inherited from ISerializableGraph
Node[] CreateNodes (int num)
 
void DeSerializeNodes (Node[] nodes, AstarSerializer serializer)
 
void SerializeNodes (Node[] nodes, AstarSerializer serializer)
 
- Public Member Functions inherited from ISerializableObject
void DeSerializeSettings (AstarSerializer serializer)
 Called to deserialize the object.
 
void SerializeSettings (AstarSerializer serializer)
 Called to serialize the object.
 
- Public Member Functions inherited from IUpdatableGraph
void UpdateArea (GraphUpdateObject o)
 Updates an area using the specified GraphUpdateObject.
 

Static Public Member Functions

static int CountChildren (Transform tr)
 Recursively counds children of a transform.
 

Public Attributes

bool autoLinkNodes = true
 
Vector3 limits
 Max distance along the axis for a connection to be valid.
 
LayerMask mask
 Layer mask to use for raycast.
 
float maxDistance = 0
 Max distance for a connection to be valid.
 
bool raycast = true
 Use raycasts to check connections.
 
bool recursive = true
 Recursively search for childnodes to the root.
 
Transform root
 Childs of this transform are treated as nodes.
 
string searchTag
 If no root is set, all nodes with the tag is used as nodes.
 
bool thickRaycast = false
 Use thick raycast.
 
float thickRaycastRadius = 1
 Thick raycast radius.
 
- Public Attributes inherited from NavGraph
byte[] _sguid
 Used to store the guid value.
 
AstarPath active
 Reference to the AstarPath object in the scene.
 
bool drawGizmos = true
 
bool infoScreenOpen
 Used in the editor to check if the info screen is open.
 
uint initialPenalty = 0
 
Matrix4x4 matrix
 A matrix for translating/rotating/scaling the graph.
 
string name
 
Node[] nodes
 All nodes this graph contains.
 
bool open
 Is the graph open in the editor
 

Private Attributes

GameObject[] nodeGameObjects
 GameObjects which defined the node in the nodes array.
 

Additional Inherited Members

- Properties inherited from NavGraph
Guid guid [get, set]
 Used as an ID of the graph, considered to be unique.
 
Matrix4x4 inverseMatrix [get]
 

Detailed Description

Basic point graph.

The List graph is the most basic graph structure, it consists of a number of interconnected points in space, waypoints or nodes.
The list graph takes a Transform object as "root", this Transform will be searched for child objects, every child object will be treated as a node. It will then check if any connections between the nodes can be made, first it will check if the distance between the nodes isn't too large ( maxDistance ) and then it will check if the axis aligned distance isn't too high. The axis aligned distance, named limits, is useful because usually an AI cannot climb very high, but linking nodes far away from each other, but on the same Y level should still be possible. limits and maxDistance won't affect anything if the values are 0 (zero) though.
Lastly it will check if there are any obstructions between the nodes using raycasting which can optionally be thick.
One thing to think about when using raycasting is to either place the nodes a small distance above the ground in your scene or to make sure that the ground is not in the raycast mask to avoid the raycast from hitting the ground.

Note
Does not support linecast because of obvious reasons.

Member Function Documentation

bool IsValidConnection ( Node  a,
Node  b,
out float  dist 
)

Returns if the connection between a and b is valid.

Checks for obstructions using raycasts (if enabled) and checks for height differences.
As a bonus, it outputs the distance between the nodes too if the connection is valid

+ Here is the caller graph for this function:

override void Scan ( )
virtual

Scans the graph, called from AstarPath.Scan Override this function to implement custom scanning logic

Implements NavGraph.

+ Here is the call graph for this function:

void UpdateArea ( GraphUpdateObject  guo)

Updates an area in the list graph.

Recalculates possibly affected connections, i.e all connectionlines passing trough the bounds of the guo will be recalculated

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

+ Here is the call graph for this function:

Member Data Documentation

Vector3 limits

Max distance along the axis for a connection to be valid.

0 = infinity

float maxDistance = 0

Max distance for a connection to be valid.

0 = infinity

GameObject [] nodeGameObjects
private

GameObjects which defined the node in the nodes array.

Entries are permitted to be null in case no GameObject was used to define a node.


The documentation for this class was generated from the following file: