Growing Tree updates NavMesh quiet often

This gif says all:

34653-tree.gif

tree is an actor, and it grows like once 1 second. If this would not be a test level there would be many trees which are growing so everywhere navmesh would rebuild all time. trees should affect navmesh, but not so often. Is there something like a “actor navmesh update rate”? Even if tree is growing, size of collision is not really changing much so it would be enough if navmesh would be updated once a minute. But if for example tree get’s cut, navmesh needs to update immediately. So I would have to change this update rate at some time. I have not found anything about such a update rate, is there anything like this?

Hi John,

In Project Settings under Navigation System, Dirty Areas Update Freq is set to 60.0 (seconds, I believe) by default. You can update this to a higher number to update it less frequently during runtime.

At moment navmesh is updating immediately, and it need to stay like this for most of actors, just trees should have a different update frequency. A general setting for this (which affects all actors) does not help me.

Ah. It’s not currently possible to separate frequency of updates by Actor. I’ve entered a feature request for this (UE-12074).

For now, your best bet is to include an invisible collision shape around your trees that is as big as it’s going to get, so navmesh doesn’t need to update to accommodate mesh’s growth. If you still want some update, you can increase size of that collision shape in increments during growth cycle in your Blueprint.

Hope that helps!

Thanks for entering of feature request!

I can’t really include an invisible collision shape around tree’s since I have to scale whole actor. All logic stuff (like growing) is actually in class “Tree” while each individual type of tree has it’s own class. So Tree parent class does not know about any meshes, it has to scale itself ( whole actor).

I guess I could make Tree class get mesh from it’s own function GetMesh() which has to be overwritten by all childs to return their mesh… That’s how I do it now :slight_smile:

You need to change your tree’s collision setup. You need to make StaticMeshComponent never affect navigation (set CanEverAffectNavigation flag to false) and add another collision shape that would represent effect you want tree to have on navmesh. You might need to switch “growing” from scaling actor to scaling StaticMeshComponent alone.

Let me know if you encounter issues with this approach.

Cheers,

–mieszko

Thanks Mieszko, this is actually how I do it now :slight_smile:
By way, it would be nice being able to set CanEverAffectNavigation with a blueprint node which is not possible unfortunately. Generally, a lot of navigation stuff is not accessible from blueprint nodes.

Regarding navigation stuff missing BP API I agree, but in this specific case it’s not needed. CanEverAffectNavigation is not intended to be changed at runtime (it’s not really supported via C++ neither), and you do have access to it via BP’s properties.

I really need to set CanEverAffectNavigation during runtime. My game is a RTS, think about having a building selected and moving mouse around to select where to place this building. During this time, building has all collision disabled since it’s really just a placeholder until I click with mouse and it get’s placed. At moment this placeholder affects all AI around it because it’s updating navmesh every frame. So if I have a building “attached” to mouse, AI around does not move at all.
I know I could make placeholder Building a completely different actor with CanEverAffectNavigation disabled, but I don’t want to have two actors for every building just because of navmesh stuff…
Is changing CanEverAffectNavigation at runtime something which is really not possible with UE4 because of some limitations or is it just something you don’t consider important?

You don’t need CanEverAffectNavigation at runtime, you need collision enabling/disabling. There might be a bug however, that has been recently fixed on main branch, that made navigation system not notice runtime changes to Actor’s collision state.