Game Development Community

Is player in the air

by University of Gotland (#0009) · in Torque Game Engine · 04/04/2006 (4:08 am) · 2 replies

Hi, how would I go about to found out if the player is currently in the air.

#1
04/04/2006 (4:46 am)
The engine does this already. Check out player.cc for details. It works by determining the player's -z velocity.

Some areas inside player.cc of interest

line 67
// Downward velocity at which we consider the player falling
static const F32 sFallingThreshold = -10;

line 1646
// If we are not touching anything and have sufficient -z vel,
   // we are falling.
   if (runSurface)
      mFalling = false;
   else {
      VectorF vel;
      mWorldToObj.mulV(mVelocity,&vel);
      mFalling = vel.z < sFallingThreshold;
   }

...and so on
#2
04/04/2006 (5:28 am)
Thanks you so much.