Skip to content

Vector Length

Provides the length of a vector.

Type ID: kaya:vector/length

Info

The formula for calculating the length of a vector is as follows: $(Length = \sqrt{X * X + Y * Y + Z * Z})$

Format

Field Type Default Description
vector Vec3 Provider The vector to get the length of.

Example

{
    "type": "kaya:vector/length",
    "vector": {
        "type": "kaya:entity/position",
        "entity": "this"
    }
}

This example will provide the length of the position vector of the entity provided by the kaya:this_entity context parameter. For example, let's say the entity's position is X: $33.0$, Y: $87.0$, Z: $242.0$. The length of the position vector will be $259.2720578851489$.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.