mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
expanded movement state data for aitonrollers
status tracking and scipt tests for stopped, inair (above a minum) and inwater
This commit is contained in:
parent
f2a5b06803
commit
311c3f224d
2 changed files with 35 additions and 1 deletions
|
|
@ -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,14 @@ void AIController::Movement::onStuck()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool AIController::Movement::isInWater()
|
||||
{
|
||||
ShapeBase* sbo = dynamic_cast<ShapeBase*>(getCtrl()->getAIInfo()->mObj.getPointer());
|
||||
if (!sbo) return false;
|
||||
F32 waterDepth = 0.0f;
|
||||
return sbo->getWaterCoverage() > 0.0f;
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIController, setMoveSpeed, void, (F32 speed), ,
|
||||
"@brief Sets the move speed for an AI object.\n\n"
|
||||
|
||||
|
|
@ -335,6 +348,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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue