- Home /
Why can't my enemies walk up an incline?
Hey all,
I was hoping someone could provide some insight to a problem I am having in my game. Currently I have my enemies spawning throughout my scene, and I have a bridge that links the two sides of my scene together. On this bridge there is a slight incline on each side and it seems as though my enemies are unable to walk over it. Right now my enemies are setup as navmesh agents; on them I have attached a simple box collider that wraps around their body, as well as a rigid body component with gravity enabled. I assume the problem may have something to do with the baked navigation settings, or the actual navmesh agent. If anyone has run into a similar problem I would really appreciate some advice.
Thanks!
Can we see code? It hard to know what you did wrong without seeing it.
Honestly, there isn't much code to show. I can attach a picture of the prefab if you would like, but the navmesh agent takes care of all of the enemy's movement.
First discern if it's a physics problem, a navigational problem, or an input problem (do they even want to go to the expected destination). Provide evidence of one or the other and give some info about what debugging problems you're having.
Can you provide a screenshot of the navmesh? Does the blue navigable area cover the incline? For example, in this screenshot the blue area covers the main floor as well as the two raised bars, meaning that the main floor and the raised bars are all navigable. Thin areas sometimes don't get marked navigable. To fix this, you need to make a finer mesh.
It does appear to be a physics related problem. From what it looks like in the editor, once the enemies reach a certain part of the incline on the bridge, their box collider collides with the bridge and prevents them from moving any further. I will attach a screenshot of my navmesh to this comment. Thanks!
Answer by meat5000 · Aug 30, 2013 at 11:14 PM
I think its why upright characters normally use Capsules. The corners of your box could be getting stuck on the incline?
Alright, so after some trial and error, and with some helpful hints that put me in the right direction, it did turn out that my problem was due to the box colliders that I had attached to my enemies. When they began to walk up an inclined plane, their box collider would collide with the ground and prevent them from moving forward. Unfortunately for me, using a capsule collider is not really an option, so I ended up just decreasing the slope of my bridge for now. Thanks for your help everyone!
Here, I converted my Uber high level comment to answer so you can give me some thumbs up :P
Thanks for your help! Don't have enough rep yet to thumbs up so I'll give ya the answer ;)