This site uses strictly necessary cookies. More Information

X- Home /

# Path finding algorithm for 2d game

I want A* path finding algorithm for my 2d game. I have read about NevMesh but it doesn't work for 2d game. If you guys have implementation of A* algorithm for 2d game then please share it.

I'm pretty sure you'll find thousands of A* algorithms with a simple search.

But that don't work for 2d games. I want implementation that work for 2d game. I have found many code links but that didn't work for 2d game.

All pathfinding projects I've seen you could just as well use sprites ins$$anonymous$$d of 3d models and an orthographic camera and suddenly it's a 2d game that uses the same pathfinding.

I read in some post that it word with 3d colliders not 2d colliders. So I conclude that those A* algorithm not work for me. If you can suggest me better algorithm then it will become helpful to me.

A* is a generic algorithm for finding the shortest path beaten nodes on a network. As long as you can represent your path space as a network then A* is good. It doesn't really care about dimensions.

**Answer** by siddharth3322
·
Oct 31, 2014 at 11:42 AM

I have to write algorithm from my self. I can't able to find 2d implementation of A* path finding algorithm.

To write algorithm, I found basic explanation from following site : Introduction to A* Pathfinding

I really appreciate their work. I have written code from their explanation as per my requirement if anybody want this implementation then message me any time.

@siddharth3322 Can you share your version of implementation ?

Okay but for this you have to give me a time. because at present I don't know where I have set my that project. $$anonymous$$essage me your email address.

i would love to see the project, can you mail it to me?! it would be life saving :)

You can send email address in P$$anonymous$$ to me.

Hi, can you share me your 2D implementation of A* Algorithm. It would be a big help. How to pm you my email. Thank you

Not OP but I got something you can use that can help you: https://github.com/RonenNess/Unity-2d-pathfinding

**Answer** by RayJr
·
Oct 29, 2014 at 01:53 PM

Take a look at HarshadK's answer in this question

http://answers.unity3d.com/questions/806298/c-how-to-move-an-npc-from-anyplace-to-a-specific-p.html

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

astar' AI falls down, doesn't follow the grid 2 Answers

How to find the shortest path? 1 Answer

2D A* pathfinding in free version? 1 Answer

How to apply A* algorithm in C#? 2 Answers

A* pathfinding - how to put penalty below a character 0 Answers