mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
dynamic_cast check for regeneration for paranoias sake + an alias method.
This commit is contained in:
parent
45055f8f3e
commit
f06db00255
1 changed files with 23 additions and 1 deletions
|
|
@ -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<NavMesh*>(set->at(i));
|
||||
NavMesh *m = dynamic_cast<NavMesh*>(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<NavMesh*>(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.")
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue