From f06db00255c85f4ea7f2d230570bc58c3f1c1a35 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 3 Dec 2015 18:34:53 -0600 Subject: [PATCH] dynamic_cast check for regeneration for paranoias sake + an alias method. --- Engine/source/navigation/navMesh.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index 738348d2f..74d71dc77 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -112,7 +112,7 @@ DefineConsoleFunction(NavMeshUpdateAll, void, (S32 objid, bool remove), (0, fals SimSet *set = NavMesh::getServerSet(); for(U32 i = 0; i < set->size(); i++) { - NavMesh *m = static_cast(set->at(i)); + NavMesh *m = dynamic_cast(set->at(i)); if (m) { m->cancelBuild(); @@ -123,6 +123,28 @@ DefineConsoleFunction(NavMeshUpdateAll, void, (S32 objid, bool remove), (0, fals obj->enableCollision(); } +DefineConsoleFunction(NavMeshUpdateAroundObject, void, (S32 objid, bool remove), (0, false), + "@brief Update all NavMesh tiles that intersect the given object's world box.") +{ + SceneObject *obj; + if (!Sim::findObject(objid, obj)) + return; + if (remove) + obj->disableCollision(); + SimSet *set = NavMesh::getServerSet(); + for (U32 i = 0; i < set->size(); i++) + { + NavMesh *m = dynamic_cast(set->at(i)); + if (m) + { + m->cancelBuild(); + m->buildTiles(obj->getWorldBox()); + } + } + if (remove) + obj->enableCollision(); +} + DefineConsoleFunction(NavMeshUpdateOne, void, (S32 meshid, S32 objid, bool remove), (0, 0, false), "@brief Update all tiles in a given NavMesh that intersect the given object's world box.") {