Non-player movement

Okay, here is what I’m trying to do – I’m creating a number of 3D game objects and having NPCs walk on top of them. This would be straightforward if the objects were all flat, but they have varying elevation. I also need to use pathfinding for all this. I’ve read over the docs, but am still not really sure of what approach to use.

Now, I have a few questions related to this –

  1. What is the best approach for making sure the NPC follows the elevation of the terrain they’re standing on? I was thinking of using a raycast and just getting the height of the object immediately below the NPC.

  2. Does using navmesh make this redundant – in other words, does navigation mean that an object is going to follow the terrain height?

  3. If the answer to #2 is no, would having a function to check height under the NPC interfere with pathfinding?

  4. Is there a better way of doing this than what I’m thinking? I don’t think I need any kind of physics functionality outside of a mesh collider on the NPCs to handle their other game functionality.


I havn’t worked with navmeshes myself, so not sure I can answer your questions, but would advice to have a look at this:
and look through five the tutorials.