Polarith AI
1.7
AIMPathfinding Class Referenceabstract

Description

This class is intended as a connector in order to integrate a custom pathfinding algorithm properly into Polarith AI so that it can cooperate with AIMFollowWaypoints

In addition, we provided some useful heuristics in order to check whether the path has to be recalculated automatically.

These heuristics are all of the abstract base type Validator. You can add a custom validator by doing the following:

  1. Create a custom validator by deriving from Validator.
  2. Add the validator to the internally used list validators.
  3. Override and adapt the method UpdateValidators to hand over necessary validator data.

Usage: Implement CalculatePath(Vector3) for computing the path and call AIMPathConnector.PathChanged if the computation has finished. You can override Update and Start in order to execute some additional functionality.

Inheritance diagram for AIMPathfinding:
AIMPathConnector AIMUnityPathfinding

Public Fields

Action PathChanged
 Processed if the path was modified or not. More...
 

Protected Fields

Vector3 destination = new Vector3()
 Destination of the current path. More...
 
GameObject destinationGameObject
 This game object determines the destination of the path to be calculated. More...
 
List< Validatorvalidators = new List<Validator>()
 These list determines the validators to be used in order to verify the path by calling Validator.Validate. More...
 
DistanceValidator distanceValidator = new DistanceValidator()
 Verifies the distance between the agent and the path. More...
 
TargetValidator targetValidator = new TargetValidator()
 Verifies if the target has moved. More...
 
TimeValidator timeValidator = new TimeValidator()
 Verifies if a set time has elapsed. More...
 
Color firstColor = Color.magenta
 Determines the color of all vertices as well as the start color of the edges. More...
 
Color secondColor = Color.cyan
 Determines the end color of the edges as well as the color of the path destination. More...
 
float scale = 1.0f
 Resizes the visualized sphere for each path point. More...
 
bool enableVisualization = true
 Specifies if path points are to be visualized or not. More...
 

Properties

Vector3 Destination [get, set]
 Gets or sets a new destination whereby a re-computation of the path starts. More...
 
GameObject DestinationGameObject [get, set]
 Sets a new target game object whereby a re-computation of the path starts. More...
 
DistanceValidator DistanceValidator [get]
 Verifies the distance between the agent and the path (read only). More...
 
TargetValidator TargetValidator [get]
 Verifies if the target has moved (read only). More...
 
TimeValidator TimeValidator [get]
 Verifies if a set time has elapsed (read only). More...
 
abstract IList< Vector3 > points [get]
 This property is used for the handling of the stored path points. More...
 

Public Methods

abstract void CalculatePath (Vector3 destination)
 Starts the pathfinding process. More...
 
virtual IList< Vector3 > GetPoints ()
 Returns the points in global coordinates, whereby it allocates memory and copies the original data. More...
 
virtual void GetPointsNonAlloc (IList< Vector3 > points)
 Returns the points in global coordinates without allocating memory. More...
 
virtual IList< Vector3 > GetLocalPoints ()
 Returns the points in local coordinates, whereby it allocates memory and copies the original data. More...
 
virtual void GetLocalPointsNonAlloc (IList< Vector3 > points)
 Returns the points in local coordinates without allocating memory. More...
 

Protected Methods

virtual void Start ()
 This method is used for setting up the internal used list validators. More...
 
virtual void Update ()
 This method verifies if the path has to be recalculated based on attached validators. More...
 
virtual void UpdateValidators ()
 Because Validator.Validate does not allow to pass parameters, the data of the validators needs to be transferred directly within this method. More...
 
virtual void OnDrawGizmos ()
 Provides a basic visualization of the given points of this path. More...
 
virtual void DrawPoint (int index)
 Visualizes a specific path point by using Gizmos.DrawSphere(Vector3, float). More...
 
virtual void DrawEdge (int startPointIndex)
 Visualizes a specific edge drawing a fancy gradient. More...
 
Imprint