mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
Merge 8411ae3c4b into a80502d50d
This commit is contained in:
commit
d0232de88b
2 changed files with 34 additions and 1 deletions
|
|
@ -180,6 +180,11 @@ bool AIController::getAIMove(Move* movePtr)
|
||||||
if (obj->getContainer()->castRay(start, end, StaticShapeObjectType, &info))
|
if (obj->getContainer()->castRay(start, end, StaticShapeObjectType, &info))
|
||||||
{
|
{
|
||||||
getNav()->repath();
|
getNav()->repath();
|
||||||
|
mMovement.mInAir = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mMovement.mInAir = true;
|
||||||
}
|
}
|
||||||
obj->enableCollision();
|
obj->enableCollision();
|
||||||
getGoal()->mInRange = false;
|
getGoal()->mInRange = false;
|
||||||
|
|
@ -307,6 +312,13 @@ void AIController::Movement::onStuck()
|
||||||
#endif
|
#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), ,
|
DefineEngineMethod(AIController, setMoveSpeed, void, (F32 speed), ,
|
||||||
"@brief Sets the move speed for an AI object.\n\n"
|
"@brief Sets the move speed for an AI object.\n\n"
|
||||||
|
|
||||||
|
|
@ -335,6 +347,23 @@ DefineEngineMethod(AIController, stop, void, (), ,
|
||||||
object->mMovement.stopMove();
|
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.
|
* Set the state of a movement trigger.
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,11 @@ public:
|
||||||
AIController* mControllerRef;
|
AIController* mControllerRef;
|
||||||
AIController* getCtrl() { return mControllerRef; };
|
AIController* getCtrl() { return mControllerRef; };
|
||||||
MoveState mMoveState;
|
MoveState mMoveState;
|
||||||
|
bool mInAir = false;
|
||||||
F32 mMoveSpeed = 1.0;
|
F32 mMoveSpeed = 1.0;
|
||||||
void setMoveSpeed(F32 speed) { mMoveSpeed = speed; };
|
void setMoveSpeed(F32 speed) { mMoveSpeed = speed; };
|
||||||
F32 getMoveSpeed() { return mMoveSpeed; };
|
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
|
Point3F mLastLocation; // For stuck check
|
||||||
S32 mMoveStuckTestCountdown; // The current countdown until at AI starts to check if it is stuck
|
S32 mMoveStuckTestCountdown; // The current countdown until at AI starts to check if it is stuck
|
||||||
Point3F mAimLocation;
|
Point3F mAimLocation;
|
||||||
|
|
@ -96,6 +97,9 @@ public:
|
||||||
bool mMoveTriggers[MaxTriggerKeys];
|
bool mMoveTriggers[MaxTriggerKeys];
|
||||||
void stopMove();
|
void stopMove();
|
||||||
void onStuck();
|
void onStuck();
|
||||||
|
bool isStopped() { return mMoveState == ModeStop; };
|
||||||
|
bool isInAir() { return mInAir; };
|
||||||
|
bool isInWater();
|
||||||
} mMovement;
|
} mMovement;
|
||||||
|
|
||||||
struct TriggerState
|
struct TriggerState
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue