[SOLVED] NavMesh and obstacles

Is there any way to put obstacles in navmesh at runtime?

Short answer: Unfortunately not.

Long answer: while the library we use does support dynamic adding of obstacles and nav agent crowds, it requires something called web workers to work properly. Unfortunately Krom does not support web workers well enough. So these features are not yet implemented.


I understand. Thank you very much.

@rpaladin How can I join two objects at runtime?

@lubos How can I join two objects at runtime?

Hey, Lubos is not active on this platform. And recently, @ rpaladin also mentioned they would be less active. But I suggest not to ping someone randomly for a general question. In the future, please ask the question, and anyone available will try to answer you.

That said, if you mean “parenting” by “join”, you have a set parent node. If you don’t mean parenting, please elaborate on what you mean by “join” and why you need something like this.


I want to create a “cube” and place it in a position then join the “cube” object with a plane to become a single object.

Okay, and why do you want this at runtime?

if you create a “plane” and put the navmesh on it then go into edit mode and add a “cube” for example. When you exit edit mode and run the game, navAgent recognizes that cube as an obstacle. this would be to create obstacles at runtime.

Right, I assumed it would be something like this. So wanted to confirm.

But the issue is that the NavMesh is generated at export of the game from Blender to Armory. So Even if you manage to join a cube to a plane at runtime, the NavMesh will not be re-generated at runtime. So, sadly, we are restricted to a static NavMesh.

Maybe you could work with physics ray cast and somehow avoid going through objects?

I’m not generating a navMesh I don’t click on the generate navmesh button. but if you modify the object that has the navmesh trait in edit mode when running the game it recognizes it as an obstacle.

This example creates cubes at runtime. so I can modify a mesh at runtime.

Yes, I know what you mean. :slightly_smiling_face:

  1. The generate NavMesh button is just to preview the generated NavMesh inside Blender. And not used in the game.

  2. When you click “Play” a new NavMesh is generated for the objects that has the “NavMesh” trait and saved to disk. This happens before the game actually starts. So at export.

  3. Once the game starts, the NavMesh is no longer generated. Instead, the NavMesh generated at the export will be used from disk. So, even if you change the mesh later in the game, the NavMesh will not be updated. That functionality is not present at runtime.

  4. Your method of changing the mesh works because it is done before the game starts, inside of Bledner

1 Like

I understood. Thanks for answering.

1 Like