Hi all,
It’s just a copy/paste of my post in the official Unity forum.
Here is my first try at using Mecanim with A* Pathfinding Project 3.4.0.5
step 1 : Take the “Nav Mesh Example” scene from Unity Mecanim example.
step 2 : Add a A* Pathfinding graph, in my test, I’ve added a GridGraph of 160 x 120 with a node size of 0.4 and with a center at 0;0;0.
step 3 : Create a script named AgentAStar.cs with the code linked.
step 4 : Modify the TeddyBear object from the scene like that:
step 5: run the scene and left click on the ground to move the bear.
Possible improvements:
- Add all Crates in an obstacle layer and mask it in the graph
- Tweak modifiers, node size, erosion …etc.
- If you own the Pro version, you can use a recast Graph for better results.
If you have a better implementation or a different working code related to Mecanim with A* pathFinding, feel free to post it here.