mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-01 02:20:59 +00:00
Merge 8411ae3c4b into a80502d50d
This commit is contained in:
commit
d0232de88b
|
|
@ -180,6 +180,11 @@ bool AIController::getAIMove(Move* movePtr)
|
|||
if (obj->getContainer()->castRay(start, end, StaticShapeObjectType, &info))
|
||||
{
|
||||
getNav()->repath();
|
||||
mMovement.mInAir = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMovement.mInAir = true;
|
||||
}
|
||||
obj->enableCollision();
|
||||
getGoal()->mInRange = false;
|
||||
|
|
@ -307,6 +312,13 @@ void AIController::Movement::onStuck()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool AIController::Movement::isInWater()
|
||||
{
|
||||
ShapeBase* sbo = dynamic_cast<ShapeBase*>(getCtrl()->getAIInfo()->mObj.getPointer());
|
||||
if (!sbo) return false;
|
||||
return sbo->getWaterCoverage() > 0.0f;
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIController, setMoveSpeed, void, (F32 speed), ,
|
||||
"@brief Sets the move speed for an AI object.\n\n"
|
||||
|
||||
|
|
@ -335,6 +347,23 @@ DefineEngineMethod(AIController, stop, void, (), ,
|
|||
object->mMovement.stopMove();
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIController, isStopped, bool, (), ,
|
||||
"@brief is the player moving?.\n\n")
|
||||
{
|
||||
return object->mMovement.isStopped();
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIController, isInAir, bool, (), ,
|
||||
"@brief is the player moving?.\n\n")
|
||||
{
|
||||
return object->mMovement.isInAir();
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIController, isInWater, bool, (), ,
|
||||
"@brief is the player in water?.\n\n")
|
||||
{
|
||||
return object->mMovement.isInWater();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of a movement trigger.
|
||||
|
|
|
|||
|
|
@ -85,10 +85,11 @@ public:
|
|||
AIController* mControllerRef;
|
||||
AIController* getCtrl() { return mControllerRef; };
|
||||
MoveState mMoveState;
|
||||
bool mInAir = false;
|
||||
F32 mMoveSpeed = 1.0;
|
||||
void setMoveSpeed(F32 speed) { mMoveSpeed = speed; };
|
||||
F32 getMoveSpeed() { return mMoveSpeed; };
|
||||
bool mMoveSlowdown; // Slowdown as we near the destination
|
||||
bool mMoveSlowdown = false; // Slowdown as we near the destination
|
||||
Point3F mLastLocation; // For stuck check
|
||||
S32 mMoveStuckTestCountdown; // The current countdown until at AI starts to check if it is stuck
|
||||
Point3F mAimLocation;
|
||||
|
|
@ -96,6 +97,9 @@ public:
|
|||
bool mMoveTriggers[MaxTriggerKeys];
|
||||
void stopMove();
|
||||
void onStuck();
|
||||
bool isStopped() { return mMoveState == ModeStop; };
|
||||
bool isInAir() { return mInAir; };
|
||||
bool isInWater();
|
||||
} mMovement;
|
||||
|
||||
struct TriggerState
|
||||
|
|
|
|||
Loading…
Reference in a new issue