Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Converting local offset to region coordinates

Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
01-12-2005 00:23
I'm rezzing an object using llRezObject, and I want to have the object appear at a specific offset from the rezzing prim, using that prim's local coordinate sytem instead of the region coordinates that llRezObject uses. For example, given the vector <2, 0, 0>, I can call the following to rez an object two meters east of the rezzing prim:

CODE
llRezObject("Foo", llGetPos() + <2, 0, 0>, ZERO_VECTOR, ZERO_ROTATION, 0);


Unfortunately, if I rotate the rezzer so its local X axis points north, this still results in the object appearing 2 meters due east of the rezzer. I'd like to be able to have <2, 0, 0> specify two meters along the rezzer's local X axis, which in this case would put the rezzed object two meters north of the rezzer.

How do I go about converting a local offset into region coordinates?
_____________________
Come visit the In Effect main store and café
Drawbridge (160, 81)
Particle effects, fashion, accessories, and coffee!
On the Web at SL Exchange and SL Boutique
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
01-12-2005 01:12
CODE
rotation myrot = llGetRot();
vector fwd = llRot2Fwd(myrot); // this is a vector that's one meter "forward" along the X axis.
llRezObject("Foo", llGetPos() + (fwd * 2), ZERO_VECTOR, ZERO_ROTATION, 0);


I think this'll do what you're lookin' fer. :D
_____________________
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
01-12-2005 02:37
rotation mine=llGetRot()
CODE

llRezObject("Foo", llGetPos() + (<2, 0, 0>*mine), ZERO_VECTOR, mine, 0);
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
01-12-2005 15:48
Thank you, Strife. That works perfectly. I went back and re-read the Operators page in the Wiki to figure out why that works. I hadn't realized that LL defined the * operator to do exactly what I want it to do when multiplying a vector by a rotation. Spiffy.
_____________________
Come visit the In Effect main store and café
Drawbridge (160, 81)
Particle effects, fashion, accessories, and coffee!
On the Web at SL Exchange and SL Boutique