Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Distance Between Two Positions

Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
11-13-2009 13:20
I basicly need to know the distance between two positions.

vector rezPos = llDetectedPos(agentNum);
vector curPos = llGetPos();
vector newPos = rezPos / curPos;

Throws up errors, any idea?
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
11-13-2009 13:23
From: Nyx Alsop
I basicly need to know the distance between two positions.

vector rezPos = llDetectedPos(agentNum);
vector curPos = llGetPos();
vector newPos = rezPos / curPos;

Throws up errors, any idea?

Check out llVecDist at http://wiki.secondlife.com/wiki/LlVecDist. It returns the distance between two vectors.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
11-13-2009 13:26
I don't think division is defined to do anything between two vectors.
To calculate the delta vector between two positions, just subtract:
vector newPos = rezPos - curPos;
But the distance is not a vector, it is a float:
float dist=llVecDist(rezPos,curPos);
or
float dist=llVecMag(rezPos-curpos);