mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
navigation: setPathdestination now takes a replace bool to preserve the goal
also killed a few now extraneous clearfollow calls
This commit is contained in:
parent
c72c3068f8
commit
f84bf058c9
3 changed files with 6 additions and 9 deletions
|
|
@ -174,15 +174,14 @@ void AINavigation::onReachDestination()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AINavigation::setPathDestination(const Point3F& pos)
|
bool AINavigation::setPathDestination(const Point3F& pos, bool replace)
|
||||||
{
|
{
|
||||||
AIGoal* curgoal = getCtrl()->getGoal();
|
if (replace)
|
||||||
|
|
||||||
if (!curgoal || !curgoal->mObj.isValid())
|
|
||||||
getCtrl()->setGoal(pos, getCtrl()->mControllerData->mMoveTolerance);
|
getCtrl()->setGoal(pos, getCtrl()->mControllerData->mMoveTolerance);
|
||||||
|
|
||||||
if (!mNavMesh)
|
if (!mNavMesh)
|
||||||
updateNavMesh();
|
updateNavMesh();
|
||||||
|
|
||||||
// If we can't find a mesh, just move regularly.
|
// If we can't find a mesh, just move regularly.
|
||||||
if (!mNavMesh)
|
if (!mNavMesh)
|
||||||
{
|
{
|
||||||
|
|
@ -213,7 +212,6 @@ bool AINavigation::setPathDestination(const Point3F& pos)
|
||||||
// Clear any current path we might have.
|
// Clear any current path we might have.
|
||||||
clearPath();
|
clearPath();
|
||||||
getCtrl()->clearCover();
|
getCtrl()->clearCover();
|
||||||
clearFollow();
|
|
||||||
// Store new path.
|
// Store new path.
|
||||||
mPathData.path = path;
|
mPathData.path = path;
|
||||||
mPathData.owned = true;
|
mPathData.owned = true;
|
||||||
|
|
@ -260,7 +258,6 @@ void AINavigation::followNavPath(NavPath* path)
|
||||||
// Get rid of our current path.
|
// Get rid of our current path.
|
||||||
clearPath();
|
clearPath();
|
||||||
getCtrl()->clearCover();
|
getCtrl()->clearCover();
|
||||||
clearFollow();
|
|
||||||
|
|
||||||
// Follow new path.
|
// Follow new path.
|
||||||
mPathData.path = path;
|
mPathData.path = path;
|
||||||
|
|
@ -316,7 +313,7 @@ DefineEngineMethod(AIController, setPathDestination, bool, (Point3F goal), ,
|
||||||
"@see getPathDestination()\n"
|
"@see getPathDestination()\n"
|
||||||
"@see setMoveDestination()\n")
|
"@see setMoveDestination()\n")
|
||||||
{
|
{
|
||||||
return object->getNav()->setPathDestination(goal);
|
return object->getNav()->setPathDestination(goal,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ struct AINavigation
|
||||||
|
|
||||||
/// Clear out the current path.
|
/// Clear out the current path.
|
||||||
void clearPath();
|
void clearPath();
|
||||||
bool setPathDestination(const Point3F& pos);
|
bool setPathDestination(const Point3F& pos, bool replace = false);
|
||||||
Point3F getPathDestination() const;
|
Point3F getPathDestination() const;
|
||||||
void repath();
|
void repath();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
||||||
if (po->getAIController())
|
if (po->getAIController())
|
||||||
{
|
{
|
||||||
if (po->getAIController()->mControllerData)
|
if (po->getAIController()->mControllerData)
|
||||||
po->getAIController()->getNav()->setPathDestination(ri.point);
|
po->getAIController()->getNav()->setPathDestination(ri.point,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue