Entity GetBounds Node
The Entity:GetBounds node can be used to obtain the bounding box size (in local or world-space coords) of an entity.
This gives us the information about the location inside the MNM area which requires updating. We'll know where the object moved to and how big it is.
AI RegenerateMNM Node
With the AI:RegenerateMNM node, we can specify a min/max Vec3 world-space coordinate of where we want the navigation mesh to be regenerated.
Technically there's no reason why we couldn't regenerate the entire level, but we want to keep the performance high so it's better to regenerate only what you need.
Example Setup
In the example below, you can see this setup being used to regenerate a small area where we're moving a GeomEntity back and forth.
The results can be seen below, taken from the Launcher. On the left we have the old results (no regeneration) and on the right using the new regeneration setup.
Beam Without Regenerate MNM | Beam With Regenerate MNM |
---|
Usage Notes
It is important to note that dynamically updating the AI navigation like this isn't without potential implications.
Level Designers need to be aware of potential issues such as AI being suddenly outside of a nav mesh area, time required for an AI navigation path to be updated with new information about the area, and so on.
Caution should be used to ensure that the AI always have a clear understanding of their surroundings, otherwise they can become stuck and behave incorrectly.