- 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.

Hellium

theness_

### People who like this

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 instead 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. Message me your email address.

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

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

### Follow this Question

### Related Questions

A* pathfinding - incorrect nodes calculated 1 Answer

Force a scan with A* Pathfinding 2 Answers

[Solved] VERY LOW FPS using Astar path finding 1 Answer

Astar Pathfinding with unity 2d 1 Answer