Packageorg.ffilmation.engine.core
Classpublic class fAiContainer

This object provides access to the AI methods of the engine.



Public Methods
 MethodDefined by
  
calculateLineOfSight(fromx:Number, fromy:Number, fromz:Number, tox:Number, toy:Number, toz:Number):Array

This methods returns an array of all the elements that cross an imaginary line between two points, sorted by distance to origin.

fAiContainer
  
findPath(origin:fPoint3d, destiny:fPoint3d, withDiagonals:Boolean = true):Array

Finds a path between 2 points, using an AStar search algorythm.

fAiContainer
  

Finds a path between 2 points, using an AStar search algorythm and a custom find criteria.

fAiContainer
Public Constants
 ConstantDefined by
  MAXSEARCHDEPTH : Number = 200
[static] This is the maximum depth pathfinding will reach before failing.
fAiContainer
Method detail
calculateLineOfSight()method
public function calculateLineOfSight(fromx:Number, fromy:Number, fromz:Number, tox:Number, toy:Number, toz:Number):Array

This methods returns an array of all the elements that cross an imaginary line between two points, sorted by distance to origin. This is a CPU-intensive calculation: Try to use it sparingly.

Parameters
fromx:Number — X coordinate for the origin
 
fromy:Number — Y coordinate for the origin
 
fromz:Number — Z coordinate for the origin
 
tox:Number — X coordinate for the destiny
 
toy:Number — Y coordinate for the destiny
 
toz:Number — Z coordinate for the destiny

Returns
Array — An array of fCoordinateOccupant elements. If the array is null or empty there's nothing between the origin point and the end point. If the origin point is outside the scene's limits, the method will return null.
findPath()method 
public function findPath(origin:fPoint3d, destiny:fPoint3d, withDiagonals:Boolean = true):Array

Finds a path between 2 points, using an AStar search algorythm. It works in 3d. This is a CPU-intensive calculation: If you have several elements trying to find its way around at the same time, it will impact your performance: try to use it sparingly. If you want an example of how to make a character walk around your scene using this, download the mynameisponcho sources from the download area.

I took it from here. Thank you!

TODO:

Parameters
origin:fPoint3d — Origin point
 
destiny:fPoint3d — Destination point
 
withDiagonals:Boolean (default = true) — Is diagonal movement allowed for this calculation ?

Returns
Array — An array of 3dPoints describing the resulting path. Null if it fails
findPathCustomCriteria()method 
public function findPathCustomCriteria(criteria:fEnginePathfindCriteria):Array

Finds a path between 2 points, using an AStar search algorythm and a custom find criteria. It works in 3d. This is a CPU-intensive calculation: If you have several elements trying to find its way around at the same time, it will impact your performance: try to use it sparingly.

Parameters
criteria:fEnginePathfindCriteria — An object implementing the fEnginePathfindCriteria interface that contains the find criteria.

Returns
Array — An array of 3dPoints describing the resulting path. Null if it fails
Constant detail
MAXSEARCHDEPTHconstant
public static const MAXSEARCHDEPTH:Number = 200

This is the maximum depth pathfinding will reach before failing.