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

Basic point graph. More...

+ Inheritance diagram for ListGraph:
+ Collaboration diagram for ListGraph:

List of all members.

Public Member Functions

int CountChildren (Transform tr)  
void AddChildren (ref int c, Transform tr)  
override void Scan ()  Scanns the graph, called from AstarPath.Scan Override this function to implement custom scanning logic.
bool IsValidConnection (Node a, Node b, out float dist)  Returns if the connection between a and b is valid.
void UpdateArea (GraphUpdateObject guo)  Updates an area in the list graph.
void SerializeNodes (Node[] nodes, AstarSerializer serializer)  
void DeSerializeNodes (Node[] nodes, AstarSerializer serializer)  
void SerializeSettings (AstarSerializer serializer)  Called to serialize the object.
void DeSerializeSettings (AstarSerializer serializer)  Called to deserialize the object.

Public Variables

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.
float maxDistance = 0  Max distance for a connection to be valid.
Vector3 limits  Max distance along the axis for a connection to be valid.
bool raycast = true  Use raycasts to check connections.
bool thickRaycast = false  Use thick raycast.
float thickRaycastRadius = 1  Thick raycast radius.
bool recursive = true  
LayerMask mask  Layer mask to use for raycast.

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.

Note:
Does not support linecast because of obvious reasons.

Member Function Documentation

void DeSerializeSettings ( AstarSerializer  serializer)

Called to deserialize the object.

All variables and data which are to be loaded should be loaded using Pathfinding::AstarSerializer::GetValue

 //Loads the integer variable myVariable from the serialized data
 myVariable = (int)serializer.GetValue ("myVariable",typeof(int)); 


A default value can also be passed, in case the variable isn't contained in the data that will be returned instead

 //Loads the integer variable myVariable with the default value of 512
 myVariable = (int)serializer.GetValue ("myVariable",typeof(int),512); 

Implements ISerializableObject.

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

override void Scan ( ) [virtual]

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

Reimplemented from NavGraph.

void SerializeSettings ( AstarSerializer  serializer)

Called to serialize the object.

All variables and data which are to be saved should be passed to the serialized using Pathfinding::AstarSerializer::AddValue

 serializer.AddValue ("myVariable",myVariable); 

Implements ISerializableObject.

Updates an area in the list graph.

Recalculates affected connections

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

Implements IUpdatableGraph.


Member Data Documentation

Vector3 limits

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

0 = infinity

LayerMask mask

Layer mask to use for raycast.

float maxDistance = 0

Max distance for a connection to be valid.

0 = infinity

bool raycast = true

Use raycasts to check connections.

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.


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