*no one asked for this, but I hope someone can find this info useful*

The **velocity** is the vector quantity that contains the magnitude (speed) and the direction of an Entity,

while the **speed** is the scalar quantity containing the magnitude of the velocity, measured in distance divided by time. (units/second)

As you know, every Entity has a .velocity vector, and from this vector we can extract the speed of an entity.

To get the velocity from a player, we simply use:

`local.velocity = local.player.velocity; // assuming local.player is a Player Entity`

Then, to get the speed we use the following formula (Pythagorean theorem):

`local.speed = sqrt(pow local.velocity[0] 2 + pow local.velocity[1] 2);`

This will return the player's speed relative to the X and Y axis (North, South, East and West) in units per second.

This can be used to get the walking/running speed of a player

If we want to convert the speed from units/s to a real life unit like feet/s or meters/s we can do the following:

local.unit["ft"] = 0.0625; // 1/16 = 0.0625

local.unit["mt"] = 0.01905; // (1/16) * 0.3048 = 0.01905

local.unit["cm"] = 1.905; // (1/16) * 30.48 = 1.905

local.ft_speed = local.speed * local.unit["ft"]; // feet/second

local.mt_speed = local.speed * local.unit["mt"]; // meters/second

local.cm_speed = local.speed * local.unit["cm"]; // centimeters/second

Now if for some reason we want to get the speed relative to the X, Y and Z axis (North, South, East, West, Up and Down)

we simply add the value of the Z axis in the velocity vector to the speed formula:

local.speed = sqrt(pow local.velocity[0] 2 + pow local.velocity[1] 2 + pow local.velocity[2] 2);

// or alternatively

local.speed = vector_length local.player.velocity;

This can be used to show the speed of a flying Entity

A simple demo script

and how does it look in game