mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
fix aim safeties to actually be safe, add an explicit clearAim script command
This commit is contained in:
parent
14a03dfc6c
commit
e37ae27bc0
2 changed files with 8 additions and 3 deletions
|
|
@ -181,6 +181,11 @@ DefineEngineMethod(AIController, setAimObject, void, (const char* objName, Point
|
||||||
object->setAim(0, 0.0f, offset);
|
object->setAim(0, 0.0f, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(AIController, clearAim, void, (), , "clears the bot's target.")
|
||||||
|
{
|
||||||
|
object->clearAim();
|
||||||
|
}
|
||||||
|
|
||||||
DefineEngineMethod(AIController, getAimObject, S32, (), ,
|
DefineEngineMethod(AIController, getAimObject, S32, (), ,
|
||||||
"@brief Gets the object the AIPlayer is targeting.\n\n"
|
"@brief Gets the object the AIPlayer is targeting.\n\n"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,10 +111,10 @@ bool AIController::getAIMove(Move* movePtr)
|
||||||
|
|
||||||
// Orient towards the aim point, aim object, or towards
|
// Orient towards the aim point, aim object, or towards
|
||||||
// our destination.
|
// our destination.
|
||||||
if (getAim()->mObj || getAim()->mPosSet || mMovement.mMoveState != ModeStop)
|
if (getAim() || mMovement.mMoveState != ModeStop)
|
||||||
{
|
{
|
||||||
// Update the aim position if we're aiming for an object or explicit position
|
// Update the aim position if we're aiming for an object or explicit position
|
||||||
if (getAim()->mObj || getAim()->mPosSet)
|
if (getAim())
|
||||||
mMovement.mAimLocation = getAim()->getPosition();
|
mMovement.mAimLocation = getAim()->getPosition();
|
||||||
else
|
else
|
||||||
mMovement.mAimLocation = getNav()->mMoveDestination;
|
mMovement.mAimLocation = getNav()->mMoveDestination;
|
||||||
|
|
@ -129,7 +129,7 @@ bool AIController::getAIMove(Move* movePtr)
|
||||||
// Test for target location in sight if it's an object. The LOS is
|
// Test for target location in sight if it's an object. The LOS is
|
||||||
// run from the eye position to the center of the object's bounding,
|
// run from the eye position to the center of the object's bounding,
|
||||||
// which is not very accurate.
|
// which is not very accurate.
|
||||||
if (getAim()->mObj)
|
if (getAim() && getAim()->mObj)
|
||||||
{
|
{
|
||||||
GameBase* gbo = dynamic_cast<GameBase*>(getAIInfo()->mObj.getPointer());
|
GameBase* gbo = dynamic_cast<GameBase*>(getAIInfo()->mObj.getPointer());
|
||||||
if (getAim()->checkInLos(gbo))
|
if (getAim()->checkInLos(gbo))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue