A* Pathfinding with mecanim and rotation

Hi!

So basically I need help to make some AI with arongranberg’s A* pathfinding project. I can not find a lot of documentation about this so I can’t figure out how to make a good AI. I followed the get started tutorial but the AI functions very poorly. My main questions is how I can use mecanim and rotating in the direction it is walking in. The script from the documentation uses Character Controller with Simple move.

So any links to any good tutorials or documentation about this really helps!

If you want to see my code, simply look at the code here: AstarAI.cs - A* Pathfinding Project
It is pretty much the same.

Thanks in advance!

Here is an answer!! :slight_smile:

	Vector3 relativePos = TARGET.position - transform.position;  
    //replace TARGET with what they should "look at"
    Quaternion rotation = Quaternion.LookRotation(relativePos);
    transform.rotation = rotation;

By adding that code right after the “controller.SimpleMove (dir);” of the AStar Pathfinder, it makes all of the units look at their target at all time!