Moai SDK  2.0
MOAIPathFinder Class Reference

Inherits MOAILuaObject.

Function List

findPath
 
getGraph
 
getPathEntry
 
getPathSize
 
init
 
reserveTerrainWeights
 
setFlags
 
setGraph
 
setHeuristic
 
setTerrainMask
 
setTerrainDeck
 
setTerrainWeight
 
setWeight
 

Function Documentation

findPath

Attempts to find an efficient path from the start node to the finish node. May be called incrementally.


function findPath ( MOAIPathFinder self [, number iterations ] )

Parameters
MOAIPathFinderself
numberiterations Optional.
Returns
boolean more
getGraph

Returns the attached graph (if any).


function getGraph ( MOAIPathFinder self )

Parameters
MOAIPathFinderself
Returns
MOAIPathGraph graph
getPathEntry

Returns a path entry. This is a node ID that may be passed back to the graph to get a location.


function getPathEntry ( MOAIPathFinder self, number index )

Parameters
MOAIPathFinderself
numberindex
Returns
number entry
getPathSize

Returns the size of the path (in nodes).


function getPathSize ( MOAIPathFinder self )

Parameters
MOAIPathFinderself
Returns
number size
init

Specify the ID of the start and target node.


function init ( MOAIPathFinder self, number startNodeID, number targetNodeID )

Parameters
MOAIPathFinderself
numberstartNodeID
numbertargetNodeID
Returns
nil
reserveTerrainWeights

Specify the size of the terrain weight vector.


function reserveTerrainWeights ( MOAIPathFinder self [, number size ] )

Parameters
MOAIPathFinderself
numbersize Optional. Default value is 0.
Returns
nil
setFlags

Set flags to use for pathfinding. These are graph specific flags provided by the graph implementation.


function setFlags ( MOAIPathFinder self [, number heuristic ] )

Parameters
MOAIPathFinderself
numberheuristic Optional.
Returns
nil
setGraph

Set graph data to use for pathfinding.


function setGraph ( MOAIPathFinder self [, MOAIGrid grid ] )

Parameters
MOAIPathFinderself
MOAIGridgrid Optional. Default value is nil.
Returns
nil
Note

function setGraph ( MOAIPathFinder self [, MOAIGridPathGraph gridPathGraph ] )

Parameters
MOAIPathFinderself
MOAIGridPathGraphgridPathGraph Optional. Default value is nil.
Returns
nil
Note
setHeuristic

Set heuristic to use for pathfinding. This is a const provided by the graph implementation being used.


function setHeuristic ( MOAIPathFinder self [, number heuristic ] )

Parameters
MOAIPathFinderself
numberheuristic Optional.
Returns
nil
setTerrainDeck

Set terrain deck to use with graph.


function setTerrainDeck ( MOAIPathFinder self [, MOAIPathTerrainDeck terrainDeck ] )

Parameters
MOAIPathFinderself
MOAIPathTerrainDeckterrainDeck Optional. Default value is nil.
Returns
nil
setTerrainMask

Set 32-bit mask to apply to terrain samples.


function setTerrainMask ( MOAIPathFinder self [, number mask ] )

Parameters
MOAIPathFinderself
numbermask Optional. Default value is 0xffffffff.
Returns
nil
setTerrainWeight

Set a component of the terrain weight vector.


function setTerrainWeight ( MOAIPathFinder self, number index [, number deltaScale, number penaltyScale ] )

Parameters
MOAIPathFinderself
numberindex
numberdeltaScale Optional. Default value is 0.
numberpenaltyScale Optional. Default value is 0.
Returns
nil
setWeight

Sets weights to be applied to G and H.


function setWeight ( MOAIPathFinder self [, number gWeight, number hWeight ] )

Parameters
MOAIPathFinderself
numbergWeight Optional. Default value is 1.0.
numberhWeight Optional. Default value is 1.0.
Returns
nil