Table of Contents

Class AStar3

Namespace
MLEM.Pathfinding
Assembly
MLEM.dll

A 3-dimensional implementation of AStar<T> that uses Microsoft.Xna.Framework.Vector3 for positions, and the manhattan distance as its heuristic.

public class AStar3 : AStar<Vector3>
Inheritance
AStar<Vector3>
AStar3
Inherited Members
Extension Methods

Constructors

AStar3(GetCost, bool, float, int, CollectAdditionalNeighbors)

public AStar3(AStar<Vector3>.GetCost defaultCostFunction, bool includeDiagonals, float defaultCost = 1, int defaultMaxTries = 10000, AStar<Vector3>.CollectAdditionalNeighbors defaultAdditionalNeighbors = null)

Parameters

defaultCostFunction AStar<Vector3>.GetCost
includeDiagonals bool
defaultCost float
defaultMaxTries int
defaultAdditionalNeighbors AStar<Vector3>.CollectAdditionalNeighbors

Methods

CollectNeighbors(Vector3, ISet<Vector3>)

This method should populate a set of positions that are considered neighbors to the given position. For example, this method might return directly adjacent positions, diagonal positions, or faraway positions that can be teleported to.

protected override void CollectNeighbors(Vector3 position, ISet<Vector3> neighbors)

Parameters

position Vector3

The position whose neighbors to return.

neighbors ISet<Vector3>

The set to populate with neighbors.

GetHeuristicDistance(Vector3, Vector3)

This method should implement a heuristic that determines the total distance between the given start position and the given second position position. Note that this is multiplied with the DefaultCost automatically, so no costs need to be considered in this method's return value.

protected override float GetHeuristicDistance(Vector3 start, Vector3 position)

Parameters

start Vector3

The start position.

position Vector3

The position to get the distance to.

Returns

float

The total distance between the two positions.