Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help transforming a vector

2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
08-14-2006 08:26
Hi,

I have a vector that is the result of a call to llGetPos(). The vector is an absolute position - I need a relative position.

For example, the the call to llGetPos() returns <100,50,10>, I want to be able to change that vector so that it becomes relative to a particular point so that when I use the new vector elsewhere I do not have to have access to <100,50,10> - it could instead become <250,188,45> but still have the same relative position to a base or other fixed point.

I use the call to llGetPos to get the position of a prim so I am not sure how to convert that vector into a relative value. Any guidance?

Thanks -2fast
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
08-14-2006 08:33
relative_pos = llGetPos() - base_pos;

Then later:

absolute_pos = relative_pos + base_pos;
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
08-14-2006 09:54
From: Seifert Surface
relative_pos = llGetPos() - base_pos;


That's it, huh? Nice :) Well....at least it is simple.

By the way, your sim is a great place - I get a lot of inspiration from your work! The crooked house is amazing -- has it ever gone off your sim as a result of someone going the same way through it all of the time?

-2fast
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
08-14-2006 13:30
From: 2fast4u Nabob
The crooked house is amazing -- has it ever gone off your sim as a result of someone going the same way through it all of the time?
It doesn't let you... I'm sure it'd disappear off the side of the sim at least once a day if it did :)
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG