GridGraph#

class in UltimateIsometricToolkit.Scripts.Pathfinding / Inherits from MonoBehaviour

Description#

node based 3d Grid graph implementation.

A node is defined as a Gap. An empty space at a given (x,z) integer position and a float startHeight and endHeight. The entire Gridgraph therefore represents an approximation of the inverse of all IsoTransform volumes combined.

Seealso

(Astar,AstarAgent)

Variables#

Type Name Description
bool ShowGraph Flag to show the graph in scene view with red gizmos
float Speed Movement speed in units per second
List<IsoTransform> Ignorables Objects to be ignored when constructing the graph

Hint

  • if the ShowGraph flag is set true but the scene view is empty the graph has not been constructed yet
  • The graph will automatically be reconstructed on Start()
  • Ignorables should contain moving objects,all AstarAgents, tiny objects, etc.
  • Moving objects will not invoke reconstructing the graph

Public functions#


Gap ClosestNode(Vector3 position)#

Returns the closes Gap to a given position in 3d isometric space


List<Gap> NodesInBounds(Vector3 min, Vector3 max)#

Returns all Gaps in the Volume (min,max)


Vector2 NodePosToGridPos(Vector3 nodePos)#

The GridGraph rasterizes the xz plane into 1x1 units. This function returns the Grid position to a position in 3d space (by flooring the x,z values)


void UpdateGraph()#

Reconstructs the Graph

Warning

Depending on the number of IsoTransforms in your scene this function may be very resource intensive and invoking it should be avoided as much as possible.