Hey if an enemy AI is following you on a nav mesh, he will stop if you get off of it. How could I make the nav mesh be everywhere, and where the AI could keep running even if I get off.

  • $\begingroup$ Could you add a little more explanation to this question? It's really hard to tell what you're asking. $\endgroup$
    – Justin
    Jul 15 '14 at 17:41
  • $\begingroup$ also a picture or .blend would be great $\endgroup$ Nov 12 '14 at 21:06
  • $\begingroup$ A picture? I just need info, there is no need of a picture of my map or anything, it is just a simple map with a nav mesh. $\endgroup$
    – blackhole
    Nov 12 '14 at 22:43
  • $\begingroup$ But where isn't the navmesh wanting to go? Is it something fixable by adjusting the options when you create the navmesh, or is it someone else? $\endgroup$ Nov 12 '14 at 22:58

I assume you're needing to handle when the player goes off-mesh for something like... elevated platforms or other unreachable areas.

The key is notifying the AI when the player is no longer on the navigation mesh. Here's one way to go about it:

  1. Duplicate the nav mesh

  2. Set the physics type to static, ghost, invisible, and give it a unique property

  3. Put a downward ray sensor on the player that sends an onmesh/offmesh message to the AI

  4. Have the AI switch states from path following to [insert desired behavior] depending on the message.

Here's an example where the AI runs straight at the player when you leave the navigation mesh.

The main problem with this method is that your AI could get stuck if the player goes offmesh without having line of sight.

For better results, I imagine you will need a very case-specific Python script that manipulates navmesh.findPath http://www.blender.org/api/blender_python_api_2_72_1/bge.types.KX_NavMeshObject.html

  • $\begingroup$ A great attempt, not exactly what I am looking for though. I just want the AI to keep chasing as if there was a nav mesh on every surface. $\endgroup$
    – blackhole
    Nov 24 '14 at 23:28
  • $\begingroup$ I suspect this will be one of those case-specific scenarios. If you want, post a screenshot showing the map, nav mesh, and location of the player. I can try to come up with something more specific. Or would this be solvable by actually covering every surface with the navmesh? $\endgroup$
    – pqftgs
    Nov 25 '14 at 1:21
  • $\begingroup$ Probably making everything have a nav mesh, because it would be weird for an enemy to use tracking when he is 1 floor below you. $\endgroup$
    – blackhole
    Nov 25 '14 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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