mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-10 06:04:37 +00:00
moar gaol tracking cleanups
This commit is contained in:
parent
2956223a60
commit
4f87ad4cf7
4 changed files with 30 additions and 28 deletions
|
|
@ -32,9 +32,9 @@ struct AIAimTarget : AIInfo
|
|||
bool checkInLos(SceneObject* target = NULL, bool _useMuzzle = false, bool _checkEnabled = false);
|
||||
bool checkInFoV(SceneObject* target = NULL, F32 camFov = 45.0f, bool _checkEnabled = false);
|
||||
F32 getTargetDistance(SceneObject* target, bool _checkEnabled);
|
||||
AIAimTarget(AIController* controller) : Parent(controller) {};
|
||||
AIAimTarget(AIController* controller, SimObjectPtr<SceneObject> objIn, F32 radIn) : Parent(controller, objIn, radIn) {};
|
||||
AIAimTarget(AIController* controller, Point3F pointIn, F32 radIn) : Parent(controller, pointIn, radIn) {};
|
||||
AIAimTarget(AIController* controller) : Parent(controller) { mTargetInLOS = false; };
|
||||
AIAimTarget(AIController* controller, SimObjectPtr<SceneObject> objIn, F32 radIn) : Parent(controller, objIn, radIn) { mTargetInLOS = false; };
|
||||
AIAimTarget(AIController* controller, Point3F pointIn, F32 radIn) : Parent(controller, pointIn, radIn) { mTargetInLOS = false; };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -82,28 +82,31 @@ bool AIController::getAIMove(Move* movePtr)
|
|||
{
|
||||
if (mMovement.mMoveState != ModeStop)
|
||||
getNav()->updateNavMesh();
|
||||
if (getGoal()->mObj.isValid())
|
||||
{
|
||||
if (getNav()->mPathData.path.isNull())
|
||||
{
|
||||
if (getGoal()->getDist() > mControllerData->mFollowTolerance)
|
||||
getNav()->followObject(getGoal()->mObj, mControllerData->mFollowTolerance);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getGoal()->getDist() > mControllerData->mFollowTolerance)
|
||||
getNav()->repath();
|
||||
|
||||
if (getGoal()->getDist() < mControllerData->mFollowTolerance)
|
||||
{
|
||||
getNav()->clearPath();
|
||||
mMovement.mMoveState = ModeStop;
|
||||
throwCallback("onTargetInRange");
|
||||
}
|
||||
else if (getGoal()->getDist() < mControllerData->mAttackRadius)
|
||||
{
|
||||
throwCallback("onTargetInFiringRange");
|
||||
}
|
||||
if (getNav()->mPathData.path.isNull())
|
||||
{
|
||||
if (getGoal()->getDist() > mControllerData->mFollowTolerance)
|
||||
{
|
||||
if (getGoal()->mObj.isValid())
|
||||
getNav()->followObject(getGoal()->mObj, mControllerData->mFollowTolerance);
|
||||
else
|
||||
getNav()->setPathDestination(getGoal()->getPosition());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getGoal()->getDist() > mControllerData->mFollowTolerance)
|
||||
getNav()->repath();
|
||||
|
||||
if (getGoal()->getDist() < mControllerData->mFollowTolerance)
|
||||
{
|
||||
getNav()->clearPath();
|
||||
mMovement.mMoveState = ModeStop;
|
||||
throwCallback("onTargetInRange");
|
||||
}
|
||||
else if (getGoal()->getDist() < mControllerData->mAttackRadius)
|
||||
{
|
||||
throwCallback("onTargetInFiringRange");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -396,6 +399,7 @@ void AIControllerData::resolveSpeed(AIController* obj, Point3F location, Move* m
|
|||
void AIControllerData::resolveStuck(AIController* obj)
|
||||
{
|
||||
if (obj->mMovement.mMoveState == AIController::ModeStop) return;
|
||||
if (!obj->getGoal()) return;
|
||||
ShapeBase* sbo = dynamic_cast<ShapeBase*>(obj->getAIInfo()->mObj.getPointer());
|
||||
// Don't check for ai stuckness if animation during
|
||||
// an anim-clip effect override.
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ void AINavigation::repath()
|
|||
if (mPathData.path.isNull() || !mPathData.owned)
|
||||
return;
|
||||
|
||||
if (!getCtrl()->getGoal()) return;
|
||||
|
||||
// If we're following, get their position.
|
||||
mPathData.path->mTo = getCtrl()->getGoal()->getPosition();
|
||||
// Update from position and replan.
|
||||
|
|
|
|||
|
|
@ -2261,9 +2261,9 @@ void Player::advanceTime(F32 dt)
|
|||
|
||||
bool Player::setAIController(SimObjectId controller)
|
||||
{
|
||||
if (Sim::findObject(controller, mAIController))
|
||||
if (Sim::findObject(controller, mAIController) && mAIController->mControllerData)
|
||||
{
|
||||
mAIController->setAIInfo(this);
|
||||
mAIController->setAIInfo(this, mAIController->mControllerData->mMoveTolerance);
|
||||
return true;
|
||||
}
|
||||
Con::errorf("unable to find AIController : %i", controller);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue