Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llRezObject question

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
06-11-2006 13:43
I am using llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param) to rez an inventory object at a specific position and rotation in relation to the prim from which it is rezzed. This is fairly easy to figure out at the start by placing the object to be rezzed correctly and using llGetPos() and llGetRotation() and some trial and error to set the parameters. But after this is working, if the original prim is rotated then the rezzed object is off. How can I fix this?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-11-2006 13:51
Well, it's rather hard to say without seeing the script, there could be all sorts of reasons, depending on what "off" means.
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
06-11-2006 14:38
Think this is what you're looking for.

CODE
        vector offset =<1,0,0>;        
vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,llGetRot(),1);
_____________________

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Not quite
06-11-2006 15:35
What is off is the rotation.

vector offset =<1,0,0>;
vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,llGetRot(),1);

does not take into account the beginning roation of the object to be rezzed only its position. So the results is that it is not rotated right when it is rezzed.
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
06-11-2006 16:03
Perhaps you want this:
CODE
        
vector offset = a;
vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,b * llGetRot(),1);

Where "a" i s whatever pos works when rezzer is at ZERO_ROTATION, and "b" is whatever rot works when the rezzer is at ZERO_ROTATION.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Sator Canetti
Frustrated Catgirl
Join date: 20 Sep 2005
Posts: 130
06-11-2006 16:06
I think the OP is asking how to best handle rezzing objects that have a non-zero rotation, which is something I've been trying to figure out myself.
_____________________
"Have gone to commit suicide. Intend to return from grave Friday. Feed cat." -- A memo by Spider Jerusalem in Transmetropolitan

"Some people are like Slinkies; not really good for anything, but they still bring a smile to your face when you push them down a flight of stairs."

If you're reading this signature, I've probably just disagreed with you. Welcome to the club :D
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Non matching rotations
06-11-2006 16:18
Sator, you are correct. If you know that in the beginning the prim that rezzes the second prim has a rotation that is different from what you the rezzed prim to be, there has to be a way to set that up. If the primary prim was at ZERO_ROTATION and the rezzed prim as turned 90 on the z axis from that. what would be it rotation is the primary prim was rotated 15 degrees on its z axis?
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
06-11-2006 21:13
urg you have no idea how many hours i tried to figure this thing out, having a object that rez a thing then it ask what to rez 1 object after.

gave up and shoved this in the second prim when its rezzed,
it does this ;

CODE

default {
on_rez(integer start_param) {
vector eul = <90,0,270>; //changeme
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul);
llSetRot(quat);
}
}


so i just link the things i want, then rotate them, look in object rotation(degrees) and then write that in instead -.- ugly i know
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
06-11-2006 21:34
I think Seifert is right

CODE
        vector offset =<1,0,0>;        
vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,<-0.44461, -0.53381, 0.53001, 0.48627>*llGetRot(),1);


This seemed to keep the Object correctly rotated in front of the rezor no matter what the rezor's rotation was, or maybe I'm missing something which is totaly posible :)
_____________________

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Partially work
06-11-2006 21:57
vector offset = a; (the difference between the rezzor and the rezzee postions)

vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,b * llGetRot(),1);

*(the rotation of the rezzee when the rezzor was at zero rotaton)



This works if I just move the object, but if I rotate it then is is off.
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
06-11-2006 23:28
What i did was letting the source rez the object (the source was rotated). After the Object was rezzed I rotated it to the rotation I wanted. I got the Object rotation from the state_entry by llSay(0,(string)llGetRot()); and put that in the source * llGetRot() and it worked. This was just with 1 prim objects. As I understand it the llGetRot() get the root prims rotation so it should work if the script is in the root prim, otherwise there's ways to get it. ExampleGetRootRot Hope it will help.
_____________________

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Not Sure Why
06-12-2006 03:38
I do not know why but it will not work for me. This is copied straght from the script.

vector offset =<-.23,0.0,0.35>;
vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,<0,0,0,1> * llGetRot(),1);

This works when the rezzor object is moved in any direction, but as soon as I rotate it the rezzed object no longer appears in the correct alignment with the rezzor. Is there anyting that I am doing wrong or that I can change to make this work correctly when the rezzor is rotated?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
06-12-2006 04:24
From: Mod Faulkner
vector offset = a; (the difference between the rezzor and the rezzee postions)

vector pos = llGetPos()+(offset*llGetRot());
llRezObject("Object",pos,<0,0,0>,b * llGetRot(),1);

*(the rotation of the rezzee when the rezzor was at zero rotaton)



This works if I just move the object, but if I rotate it then is is off.

Try swapping the order of the multiplication i.e. llGetRot() * b

I do have devices which do this sort of thing, but I'm not in-world at the moment, won't be for a while and can't remember the exact code, but I think I do it that way round.
Sitting Lightcloud
Registered User
Join date: 13 May 2004
Posts: 109
06-12-2006 07:30
From: Ordinal Malaprop
Try swapping the order of the multiplication i.e. llGetRot() * b

In my tests it would not work with llGetRot() * b, would cause it to be off.

Maybe some genious matematician can explain why :D
_____________________

Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
06-12-2006 12:14
The way I remember which way round it is is to look at rotating a vector by a rotation. When rezzing something from a base prim, at some offset vector, the place you want to rez it at is offset_pos * base_rot, and here there is no choice in the ordering. Similarly, to give it some "offset" rotation from the base prim, use offset_rot * base_rot.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Julia Banshee
Perplexed Pixie
Join date: 16 Jan 2006
Posts: 97
06-12-2006 13:39
From: Ordinal Malaprop
Try swapping the order of the multiplication i.e. llGetRot() * b

*screams*

I spent several hours one day playing with every possible combination of things trying to solve this one and failed. I tried multiplying the desired rotation by llGetRot(), I tried dividing, I tried dividing ZERO_ROTATION by it, by their products, by the division of them, and on and on... and not even once did it occur to me that it might be the case that A * B != B * A. Grrr...