AStar.Traveler

Description

Provides access to data and methods related to an A* traveler.

Properties

isActive Returns 1 if the traveler is actively performing a travel task, 0 otherwise.
isBlocked Returns 1 if the traveler is currently blocked by an accumulation cell allocation request.
object Returns the TaskExecuter that is associated with this A* traveler.
travelPath Accesses the traveler's current travel path.

Methods

addAllocation For future use. Adds an accumulation allocation to the traveler's scheduled cell allocations.
arriveAtBridge For future use. Notifies A* that the traveler has arrived at a bridge/elevator associated with a specific cell in its travel path, handing over control to the bridge.
calculatePath For future use. Calculates the A* path to the destination and stores it in the traveler's travelPath property.
findCollision For future use. Finds an existing allocation that "collides" with the passed allocation.
finishPath For future use. Notifies A* that the traveler is finished traveling.
getAllocations Gets an array of AStar.Allocations that the traveler has currently allocated or is scheduled to have allocated at a given time.
navigatePath For future use. Initiates the logic that builds kinematics and cell allocations along the traveler's calculated path.

Constructor

AStar.Traveler Constructs an AStar.Traveler object based on the given TaskExecuter.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.isActive

readonly int isActive

Description

Returns 1 if the traveler is actively performing a travel task, 0 otherwise.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.isBlocked

readonly int isBlocked

Description

Returns 1 if the traveler is currently blocked by an accumulation cell allocation request.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.object

readonly TaskExecuter object

Description

Returns the TaskExecuter that is associated with this A* traveler.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.travelPath

readonly travelPath

Description

Accesses the traveler's current travel path.

A traveler's travelPath describes the current sequence of A* grid cells that the traveler will traverse in traveling to its current destination. The travelPath can be accessed using array-type usage, including using the "length" property and array accessors.

for (int i = 1; i <= traveler.travelPath.length; i++) {
	AStar.Cell cell = traveler.travelPath[i].cell;
	...
}

Each element of the travelPath includes the AStar.Cell to be traversed.

AStar.Cell cell = traveler.travelPath[1].cell;

The travelPath also includes an indexOf() method to find which index (if any) corresponds to a given grid cell.

int index = traveler.travelPath.indexOf(cell);

The travelPath also includes an isBlocked() method. This would be used when you dynamically change the A* grid and want to see if you should preempt the traveler to have it recalculate its path based on the new grid change.

if (traveler.travelPath.isBlocked()) {
...
}
Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.addAllocation()

addAllocation( AStar.Allocation alloc , int force , int notifyPendingAllocations )

Parameters

alloc The target allocation to add.
force Pass 1 to force the allocation to be added regardless of collisions with other allocations, 0 otherwise.
notifyPendingAllocation Pass 1 to cause colliding travelers to create an OnBlock event when they collide with this allocation.

Description

For future use. Adds an accumulation allocation to the traveler's scheduled cell allocations.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc. For normal users, this method is automatically called by navigatePath().

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.arriveAtBridge()

arriveAtBridge( int pathIndex )

Parameters

pathIndex The index of the travel path associated with the bridge.

Description

For future use. Notifies A* that the traveler has arrived at a bridge/elevator associated with a specific cell in its travel path, handing over control to the bridge.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.calculatePath()

calculatePath( Object object , int flags = 0 )
calculatePath( Vec3 dest , int flags = 0 )

Parameters

object The target destination object.
dest The target destination model location.
flags Configuration flags for the calculation.

Description

For future use. Calculates the A* path to the destination and stores it in the traveler's travelPath property.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.findCollision()

findCollision( AStar.Allocation alloc , int ignoreSameTravelerAllocs )

Parameters

alloc The target allocation to add.
ignoreSameTravelerAllocs If 1, the search will not look at allocations for this traveler.

Description

For future use. Finds an existing allocation that "collides" with the passed allocation.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.finishPath()

finishPath( )

Description

For future use. Notifies A* that the traveler is finished traveling.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.getAllocations()

getAllocations( double time = -1 )

Parameters

time The target time for retrieving the set of allocations.

Description

Gets an array of AStar.Allocations that the traveler has currently allocated or is scheduled to have allocated at a given time.

The allocations can be accessed as an array, including using the length property and array accessor.

var allocations = traveler.getAllocations();
for (int i = 1; i <= allocations.length; i++) {
	AStar.Cell cell = allocations[i].cell;
}

Note that a traveler's allocations are correlated with, yet distinct from, a traveler's travelPath. Each entry in a traveler's path can have up to 3 allocations associated with it, specifically when the traveler is traveling diagonally. For example, if a traveler's travelPath includes a traversal from cell (4, 4) to cell (5, 5), the traveler would need to allocate, as part of traversing that diagonal, cells (4, 5) and (5, 4), in addition to the destination cell (5, 5).

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler.navigatePath()

navigatePath( int startAtIndex )

Parameters

startIndex The one-based travel path index of the cell to first travel one.

Description

For future use. Initiates the logic that builds kinematics and cell allocations along the traveler's calculated path.

This method call is meant for advanced users who are implementing their own A* allocation/navigation schemes. You should only call this method if you are overriding default path calculation/navigation mechanism by listening to traveler events like OnCalculatePath, etc.

Do no remove, this fixes the anchor on doc.flexsim.com

AStar.Traveler Constructor

AStar.Traveler( treenode te )

Parameters

te A TaskExecuter that is connected to the A* network as an A* Traveler.

Description

Constructs an AStar.Traveler object based on the given TaskExecuter.

Casting from a treenode is not correct.
AStar.Traveler traveler = AStar.Traveler(te); // correct
AStar.Traveler traveler = te; // incorrect