Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a game in Unity3D. I want an enemy character to follow the player around. The problem is, my surface is uneven and full of mountains. I am using aarongranberg's pathfinding project. Every time that a player climbs a hill or a mountain, the enemy stops because the grid is flat and it considers the mountain to be an obstacle. How do I solve this problem ?

share|improve this question
Don't make mountains an obstacle, just give them a higher cost than flat land... – BlueRaja - Danny Pflughoeft Aug 29 '14 at 17:41
How do i do that ? – user3889649 Aug 29 '14 at 17:53
Read the instructions on how to use your pathfinding library? Setting path-costs is a basic prerequisite for using A* on a graph. – BlueRaja - Danny Pflughoeft Aug 29 '14 at 18:01
Thanks a lot. Should have done that . – user3889649 Aug 29 '14 at 18:04
Maybe post an answer of how you solved your specific problem afterwards and accept it. – J_F_B_M Aug 29 '14 at 21:50

Essentialy A* needs to be configured with what is not an accessible tile , so you can configure that by making an algorithm using gameObjects 'surface taken on the terrain then calculate the tiles to avoid at runtime .Then add it to the closed list (if there is not something for that already )

share|improve this answer

Within this project, you are able to define what is passable and impassable terrain. If you recast the graph and alter the maximum slope that's walkable to the gradient of your mountains, they should be included in the navmesh, albeit at a higher cost to use.

There may be other ways, but ultimately, what you want to be looking to do is include the mountain in the mesh as a highly weighted path. I'd recommend reading through the documentation for your A* project

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.