How to make AIPath (A*) work on 2D game ?

I have 2D scene which got wall sprites and two vehicle sprites. All of them has 2D colliders. I have GameObject with AstarPath component.

I have created Grid graph, rotated it to 90 degrees by X axis. I have ticked Use 2D Physics and collider type RAY. Then changed size of my grid to make it have larger area.

Then added AIPath and Seeker to my vehicles and made target to each of them.

When I start play mode, both vehicles starts to move each other. However, they also start rotating in Y axis, they must be rotating by Z axis to make them look like steering. What I did wrong?

For arongranbergs in 2D there are a couple of options

  • Wrap the vector inputs and outputs from the path finding engine in a class that lets you work with your dimensions
  • Switch your project to work in dimensions that are compatible with the project (ie camera looking down the y axis
  • Break open the code and switch the dimensions around. You may find someone who has already done this
  • Use a version of A* implemented specifically for 2D
  • Implement A* your self (This is not overly difficult for someone of intermediate scripting ability)