Optimize automatic navmesh rebuild in editor for navmesh relevant actors only

This commit is contained in:
Wojtek Figat
2021-02-19 13:02:27 +01:00
parent 9f80b9853c
commit 6d7bd78816
11 changed files with 51 additions and 11 deletions

View File

@@ -76,6 +76,29 @@ namespace FlaxEditor.SceneGraph
_treeNode.LinkNode(this);
}
/// <summary>
/// Gets a value indicating whether this actor affects navigation.
/// </summary>
public virtual bool AffectsNavigation => false;
/// <summary>
/// Gets a value indicating whether this actor affects navigation or any of its children (recursive).
/// </summary>
public bool AffectsNavigationWithChildren
{
get
{
if (_actor.HasStaticFlag(StaticFlags.Navigation) && AffectsNavigation)
return true;
for (var i = 0; i < ChildNodes.Count; i++)
{
if (ChildNodes[i] is ActorNode actorChild && actorChild.AffectsNavigationWithChildren)
return true;
}
return false;
}
}
/// <summary>
/// Tries to find the tree node for the specified actor.
/// </summary>