Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

quick llRezObject question

Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
02-05-2008 05:45
Hi, I have a vehicle which rezes a smaller object inside it on command, the problem I have is trying to get the offset position to be relative to the direction its faceing, i.e. if its facing east it would be <2,0,-1.9> but west would need to be <-2,0,-1.9>, I know theres math ways to solve it but the only ones I've looked are geared to a moving linked part ( like a turret) and the math seems to work realtive to linked position to root pos.

Were with mine its rezing from the root. any help would be appreciated
heres the code I'm playing with.

rot = <0,0,0,1> * (llGetLocalRot() * llGetRootRotation());
pos = llGetRootPosition() + (llGetLocalPos() * llGetRootRotation()) + (REZ_OFF * rot);
llRezObject( "Wasp", pos, <0,0,0>, llGetRot(), 1);

rot and pos are empty rotation/vector REZ_OFF is a vector which is the offest when the vehicle is rotated to 0,0,0. This code dosn't work at all at the moment which might be beacuse I'm useing the root to rez it from.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-05-2008 10:00
The llRez...() functions use absolute coordinates. So you need something like:

CODE

vector REZ_POS_RELATIVE = <2.0, 0.0, -1.9>;
rotation REZ_ROT_REALATIVE = ZERO_ROTATION;
// ...
vector pos = llGetPos();
rotation rot = llGetRot();
vector rezPos = pos+REZ_POS_RELATIVE*rot;
rotation rezRot = REZ_ROT_REALATIVE*rot;


The last line also allows you to rez the object in a fixed orientation relative to the rezzing object. Just use 'rot' or ZERO_ROTATION for the rez if you really don't care about the orientation.
Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
02-05-2008 12:26
ok so I just need to multiply the offset by the current rotation and add the current position for this job (it rezes with the same orientation as the sorce vehicle), I'l give it a go. thank you