mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +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
|
|
@ -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 (!curgoal || !curgoal->mObj.isValid())
|
||||
if (replace)
|
||||
getCtrl()->setGoal(pos, getCtrl()->mControllerData->mMoveTolerance);
|
||||
|
||||
if (!mNavMesh)
|
||||
updateNavMesh();
|
||||
|
||||
// If we can't find a mesh, just move regularly.
|
||||
if (!mNavMesh)
|
||||
{
|
||||
|
|
@ -213,7 +212,6 @@ bool AINavigation::setPathDestination(const Point3F& pos)
|
|||
// Clear any current path we might have.
|
||||
clearPath();
|
||||
getCtrl()->clearCover();
|
||||
clearFollow();
|
||||
// Store new path.
|
||||
mPathData.path = path;
|
||||
mPathData.owned = true;
|
||||
|
|
@ -260,7 +258,6 @@ void AINavigation::followNavPath(NavPath* path)
|
|||
// Get rid of our current path.
|
||||
clearPath();
|
||||
getCtrl()->clearCover();
|
||||
clearFollow();
|
||||
|
||||
// Follow new path.
|
||||
mPathData.path = path;
|
||||
|
|
@ -316,7 +313,7 @@ DefineEngineMethod(AIController, setPathDestination, bool, (Point3F goal), ,
|
|||
"@see getPathDestination()\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.
|
||||
void clearPath();
|
||||
bool setPathDestination(const Point3F& pos);
|
||||
bool setPathDestination(const Point3F& pos, bool replace = false);
|
||||
Point3F getPathDestination() const;
|
||||
void repath();
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ void GuiNavEditorCtrl::on3DMouseDown(const Gui3DMouseEvent & event)
|
|||
if (po->getAIController())
|
||||
{
|
||||
if (po->getAIController()->mControllerData)
|
||||
po->getAIController()->getNav()->setPathDestination(ri.point);
|
||||
po->getAIController()->getNav()->setPathDestination(ri.point,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue