Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - shiba_nivengo

Pages: [1]
1
Support / Re: A* Pathfinding
« on: September 12, 2014, 03:51:23 am »
Sorry to necro a thread, but I thought I'd give an update to this, because A* Pathfinding has historically been a hard thing to implement; obvious to all who are doing a quick search on these forums.  So this is for the benefit of someone doing a search, trying to find a pathfinding solution.  Or something for the author to link for someone who asks in the future.

http://arongranberg.com/astar/

This pathfinding software, The A* Pathfinding Project, has been recommended in the past for being a decent solution for 2D, however, it did not take into account 2D Edge Colliders, which is what 2D Toolkit uses, based on my research.

Well, what was really happening was that the A* Pathfinding Project used the Physics2D API that came packaged with Unity, which didn't take 2D Edge Colliders into account as of Unity 4.3.

Well, as of Unity 4.5.1 The Physics2D API *DOES* detect 2D Edge Colliders, which means, The A* Pathfinding Project, linked above, works with 2DToolkit right out of the box.*

*You do have to do a little bit of tinkering; it works on the XZ axis by default, you just have to change a couple of parameters to get it to work on the XY axis.

Basically, in your grid graph, give it a 90 rotation on the x axis to point it in the right direction.  Make sure 2D Physics is checked, and change the climb axis to Z.  That's it.  :)

After reading this post I downloaded A* pathfinding project and tried to create a grid graph. However, it only detects collisions with my characters (which have box colliders) but not with the tiles created by 2DToolkit (which are edge colliders). Have you actually made pathfinding project work with 2Dtoolkit? Is there anything else to do besides rotating the grid -90 on x and setting z as the climb axis?

**Edit: Just found the problem. The collider type for the collision testing has to be sphere.

Pages: [1]