@@ -180,6 +180,11 @@ bool AIController::getAIMove(Move* movePtr)
180180 if (obj->getContainer ()->castRay (start, end, StaticShapeObjectType, &info))
181181 {
182182 getNav ()->repath ();
183+ mMovement .mInAir = false ;
184+ }
185+ else
186+ {
187+ mMovement .mInAir = true ;
183188 }
184189 obj->enableCollision ();
185190 getGoal ()->mInRange = false ;
@@ -307,6 +312,13 @@ void AIController::Movement::onStuck()
307312#endif
308313}
309314
315+ bool AIController::Movement::isInWater ()
316+ {
317+ ShapeBase* sbo = dynamic_cast <ShapeBase*>(getCtrl ()->getAIInfo ()->mObj .getPointer ());
318+ if (!sbo) return false ;
319+ return sbo->getWaterCoverage () > 0 .0f ;
320+ }
321+
310322DefineEngineMethod (AIController, setMoveSpeed, void , (F32 speed), ,
311323 "@brief Sets the move speed for an AI object.\n\n"
312324
@@ -335,6 +347,23 @@ DefineEngineMethod(AIController, stop, void, (), ,
335347 object->mMovement .stopMove ();
336348}
337349
350+ DefineEngineMethod (AIController, isStopped, bool , (), ,
351+ "@brief is the player moving?.\n\n")
352+ {
353+ return object->mMovement .isStopped ();
354+ }
355+
356+ DefineEngineMethod (AIController, isInAir, bool , (), ,
357+ "@brief is the player moving?.\n\n")
358+ {
359+ return object->mMovement .isInAir ();
360+ }
361+
362+ DefineEngineMethod (AIController, isInWater, bool , (), ,
363+ "@brief is the player in water?.\n\n")
364+ {
365+ return object->mMovement .isInWater ();
366+ }
338367
339368/* *
340369 * Set the state of a movement trigger.
0 commit comments