A* Pathfinding 2.0 Released!!

Now version 2.0 is released.
It’s a big update full with new features.

Multiple grids
Use as many grids as you want, for example one for every floor in a building.
This means 3D pathfinding!

Node linking
Link a node to any other node in any grid. In a stair to another floor maybe?

Flood Fill
It now flood fills the entire map to avoid trying to calculate a path when there is no possible solution.

Height raycasting
You are no longer limited to the terrain for defining height, it can now raycast to see where the ground is.

Runtime changing of the grid
You can now recalculate the whole, or a part of the grid whenever you want, useful if you for example want to place a building in your scene at runtime.

And much more!

This new update makes it possible to execute pathfinding in buildings with elevators and stairs.
It makes it even better for RTS games since you now can use a single line to recalculate a part of the grid when you have placed a building somewhere.
And it can handle 40 units without any lag (depending on the computer of course, but it’s still fast).

So, download it and start playing with it right now.
http://www.arongranberg.com/unity/a-pathfinding/

Or look at the demo here
http://www.arongranberg.com/unity/a-pathfinding/terrain/
and here
http://www.arongranberg.com/unity/a-pathfinding/building/

Cool, will try this in my next project. Good work!

Oh this does look really great!

I’ll try and implement this into my ‘Arab’ project… Or will we be seeing v3 in another 2 weeks time :wink:. Great work and many thanks for sharing.

Matt.

Looks pretty nice, I’ll have to download it when I have a few minutes.

Hey there Aron, again brilliant, but also I’m seeing it became a tiny bit more complicated…so it’s not as simple (for me) to get it working on iPhone like the last version.

I don’t think this is the place so I’ll link you to a more appropriate thread where maybe I can get some insight as to the changes and maybe get 2.x working on the phone. :slight_smile:

Here I’ll post my questions.

Thanks so much again bud!!

-Steve

cool! good job

Nice job, works great!

Took a bit to figure out making the grid. I didn’t realize at first that the grid was actually a box and I needed to change the height to enclose everything. Couldn’t get raycast to work until I found the mask.

Thank you very much for sharing your work.
These are very useful scripts , thanks again.


oxl

I sometimes get this error.

NullReferenceException: Object reference not set to an instance of an object
AstarClasses.Node.get_g () (at Assets\pathfinding\AstarClasses.cs:104)