Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
2  
Don't make mountains an obstacle, just give them a higher cost than flat land... –  BlueRaja - Danny Pflughoeft Aug 29 at 17:41
    
How do i do that ? –  user3889649 Aug 29 at 17:53
4  
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 at 18:01
    
Thanks a lot. Should have done that . –  user3889649 Aug 29 at 18:04
    
Maybe post an answer of how you solved your specific problem afterwards and accept it. –  Larethian Aug 29 at 21:50

1 Answer 1

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

 
discard

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.