Skip to content

A-Star Implementation/Playground

Here is an online version of an A-Star Pathfinder in Unity3D.  Here is a link to the source.  Please play with it and look at the source.  The source is close but not identical to the code in the book.  The code in the book was incomplete and wouldn’t run as is.

I just updated the sandbox to include a variable “heuristic”.  In this case it is just a float that scales the distance calculation to the goal.  When it is zero A-Star is equivalent to Dijkstra.  Notice as the value gets higher the search spreads out less and searches fewer nodes.  However as it narrows it can return a non-optimal path.  But if you play long enough you can see that some non-optimal paths still look intelligent and plausible.

Post a Comment

You must be logged in to post a comment.