Pathfinding#

The ultimate isometric toolkit offers a pathfinding solution. It is currently still under development and not polished.

Adding Pathfinding to your Project#

Pathfinding is implemented using the A* algorithm which operates on a graph. You can extend pathfinding by implementing your own Graph or use the GridGraph component that comes with it.

Summary

Create a new empty GameObject and add the GridGraph component

alt text

The GridGraph discretizes the entire ismetric space into cells of 1x1 blocks. It then goes over all IsoTransforms in the scene and creates a negative to create the 'walkable' area.

  • Scanheight The maximum height in isometric space to be taken into account when creating the graph
  • Show Graph Enables/Disables Editor debugging
  • Ignorables A list of IsoTransforms to be ignored when constructing the 'walkable' area. Add your AstarAgent, NPCs, tiny objects, etc.

The Graph will be updated once on void Awake(). To highlight the graph in the editor press 'Upate Graph' in the inspector window of the GridGraph component

Adding the Astar Agent#

Agents are responsible to find path from a to b.

Summary

  • Add the AstarAgent component to any of your character sprites.
  • Add the character to the Ignorables list of your GridGraph compoent
  • Reference the GridGraph to the AstarAgent in the inspector window
  • To invoke pathfinding call AstarAgent.MoveTo(Vector3 destination) from any other script.

alt text

  • JumpHeight The maximum allowed distance on the y axis to travel between to adjacent nodes.
  • Speed The Speed in units per second
  • Graph The Graph to operate on
  • Heuristic The A* heuristic to use when searching for a path, euclidian is what you will use in most cases

The AStarTestScript shows how to invoke pathfinding for an AstarAgent using raycasting.

Note

The AStarTestScript uses raycasting to find the input position and requires colliders on all IsoTransform of your scenery.