Don't click here unless you want to be banned.

LSL Wiki : llVecDist

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
float llVecDist(vector v1, vector v2)

This function returns the distance between two positional vectors. Here's a table of examples:

v1v2 return value

The equation for finding vector distance with components is sqrt((x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2).
or llVecMag(v1 - v2);

vector VecNorm(vector v) {
    return (v / VecMag(v));

float VecMag(vector v) {
    return llSqrt(v.x*v.x + v.y*v.y + v.z*v.z);

float VecDist(vector a, vector b) {
    return VecMag(a - b);

Compare with llVecMag, and llVecNorm.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions / Vectors
There are 2 comments on this page. [Display comments/form]