Pat AfterMoon
Hobbyist Game Dev.
Bio Links Contact

Unity 3D
Game Development
2014 Connected Pylons 2011 prototype Online Demo
(December 1, 2011)
2009 prototype Forum

GPL Quake
Mod. Development
My favorite tools COOP or DIE
for Quake2
Forum QuakeSrc Index Tremulous bots











© Copyright 2001-2014
Pat AfterMoon

 CopyrightFrance.com
Copyrightdeposit.com






Hobbyist Game Developer: Pat AfterMoon's blog




January 20, 2014

Porting the Pathfinding Unity Mecanim example to A-Star


Ground vehicle in action While working on my project, I've looked at Mecanim for the animation of my AI agents. Here is my first try at using Mecanim with Aron Granberg A* Pathfinding Project.

step 1 : Take the "Nav Mesh Example" scene from Unity Mecanim Example Scenes.

step 2 : Import the free version of Aron Granberg A* Pathfinding in the project, and add a A* Pathfinding graph. For my test, I've used the 3.4.0.5 version, and 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. Remove the Agent script and the NavMeshAgent component. Add the Seeker and the SimpleSmoothModifier scripts from A* project and add the AgentAStar script described above.
It should look like that: TeddyBear in inspector

step 5: It's done! 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, feel free to post it on the official A* pathFinding forum.