I realize that Unity2D has just been released, but I want to ask if there's any solutions to pathfinding and navigation that can be used for it? I tried Aron's A* plugin, but it doesn't seem to work with 2D colliders, just 3D ones. I don't know if I should use a mix of 2D and 3D colliders and how efficient that will be.. (2D for physics and 3D for the pathfinding) or if there is an upcoming plugin for that.
That is something I was wondering as well. I really think that they should make possible to user navmesh with the 2D system in a convinient way
By 2D pathfinding do you mean platform game style or top down? top down is trivial with http://arongranberg.com/astar/ or navmesh. 2D Platform game pathfinding is by large not necessary. It becomes really necessary when you have island situations and things like that, and A* isn't the sole solution, but more of a check for an opening.
I believe you want to use a nav mesh. It should work for your top-down game. You can find more information here: http://docs.unity3d.com/Documentation/Manual/NavmeshandPathfinding.html
I haven't used unity in a while, and never got around to Navmeshes. Is it still an pro only solution, since I have the free version. Also, will it enable group pathfinding that's available in Aron's A*? I know it works with colliders, but I don't know if it will work with a nav mesh to allow avoiding dynamic obstacles.
could use 2d ray casting to detect 2d Colliders, and just do some simple collision avoidance, like "if ( I'm about to hit wall) { avoid it }" kind of thing...
Just fyi (I know the post is a few weeks old). The A* Pathfinding Project now supports 2D colliders when using grid graphs.
Hey guys, just jumping in with more questions (i figure that's the right thing to do right? rather than start a new thread for the same topic?) I'm working on a point and click adventure game and I've kinda hit a wall with the code, so far I have a ray from the mouse checking if you've clicked on the floor collider then using the Vec2 position as an iTween.MoveTo position (i can share the code if anyone's interested). Works great so far but as the level is a flat sprite and any form is merely 'suggested' it won't necessarily have colliders/gaps in the way for an engine to use. I was thinking i'd probably have to overlay a series of polygons over it to map out the ok areas by hand. Anyone got any other thoughts?
Actually this is something of how I wanted to do it for my Adventure Game Framework as well (sig if interested). So I've made up a pathfinding package as standalone since it might find other uses as well, you can see it here if you like: http://forum.unity3d.com/threads/224962-Poly-Nav-Pathfinding-for-4-3-2D Sorry if this sounded like a shameless promotion..
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.
@Nelson Punch, Thanks for your help but now I covered this thing http://answers.unity3d.com/questions/820030/path-finding-algorithm-for-2d-game.html I have shared my answer for other member also.
You can use build in pathfinding with navigation and agents. You need to use NavMeshSurface to fulfil your needs Here how its done https://github.com/h8man/NavMeshPlus Demo with NavMeshAgents chasing around https://github.com/h8man/RedHotSweetPepper Also added windows binaries to try it out https://github.com/h8man/RedHotSweetPepper/releases
I found the easiest solution was simply to manage/update a 2D array in the code (very easy to do if you're using a tilemap) and have the A* Pathfinding base everything off the array. No need for Unity itself to do anything at all. Very efficient too - updating an array costs barely nothing at all. (Obviously the sequence of when objects update the array needs to be done with some careful thought, to avoid units physically moving into/through nodes too soon).
Hellow guys, i have an issue I saw the youtube video of Brackerys about pathfinding, it works well but just for region or space The space between the red lines is where the pathfinding method works well, if the enemy is out of the red line their pathfinding component makes him to return to the line and not to follow my playable character Between the red lines the enemys follows the playable charater well I dont know what this could be, please help with this topic If need it i will show the code Thanks guys