A* script not returning the correct path

Hello I’ve been working on a simple A* path finder for Unity in C# from various tutorials. But i don’t know why mine is not working as desired – it seems to return no valid path. My grid is setup different to most so i had to tweak it which might be why it doesn’t work. My grid structure is setup in a list of a class rather than a 2D grid that most people use. Like so: tile.Add(new Grid(0,0)); tile.Add(new Grid(-1,0)); tile.Add(new Grid(-2,0)); tile.Add(new Grid(1,0)); tile.Add(new Grid(2,0)); So my test data was like this:  Start Pos: -2,0 End Pos 2,0 Debug.Log(path.Count); = 0; //essentially no path was found This is clearly incorrect. This is my path finding function: public List FindPath(Grid startPos, Grid endPos){ Node startNode = new Node(startPos);…


Link to Full Article: A* script not returning the correct path

Pin It on Pinterest

Share This

Join Our Newsletter

Sign up to our mailing list to receive the latest news and updates about homeAI.info and the Informed.AI Network of AI related websites which includes Events.AI, Neurons.AI, Awards.AI, and Vocation.AI

You have Successfully Subscribed!