GetActorVelZ

From ZDoom Wiki
Jump to navigation Jump to search

fixed GetActorVelZ (int tid)

Usage

This returns the velocity of the actor along the Z axis. Positive values means upward movement; negative values are downward.

Parameters

  • tid: TID of the actor.

Return value

The Z velocity of the actor, as a fixed point value.

Examples

This example prints the current speed of the player, using the FixedSqrt function.

script 1 enter
{
  int x, y, z, speed;
  while (TRUE)
  {
    x = GetActorVelX(0);
    y = GetActorVelY(0);
    z = GetActorVelZ(0);
    speed = FixedMul(x, x) + FixedMul(y, y) + FixedMul(z, z);
    print(f:FixedSqrt(speed));
    delay(1);
  }
}