Rez objects relative to rezzer rotation
|
Oberon Onmura
Registered User
Join date: 28 Dec 2006
Posts: 125
|
03-08-2009 14:14
Hi all --
I can script a prim to rez a row of objects along, say, the x axis. Piece of cake. But when I rotate the rezzer prim, it continues to rez the objects along the region's x axis, and ignores the prim's local axis rotation.
I know how to modify the rezzed object's rotation relative to the rezzer prim's rotation, but I can't seem to get the rezzed object's position to reflect the rezzer prims's local rotation. What am I missing??
Thanks in advance!
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-08-2009 14:58
The OFFSET of the rez position from the rezzer's position should be multiplied by (transformed using) the rezzer's rotation.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-08-2009 16:51
formula described: offset = localOffsetVector * llGetRot();
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Evo Hak
Registered User
Join date: 30 Apr 2008
Posts: 5
|
09-02-2009 14:59
I'm new to scripting and I've got a very basic understanding of how things are done. I'm trying to do the same as the OP but even after a long bout of help from an experienced scripter, using specific vectors such as pos, rot and posOffset, I'm not sure what I'm doing wrong yet. I know I'm missing something, but I'm not sure what it should be. default { state_entry() { llListen(1138,"",NULL_KEY,""  ; } listen(integer channel, string name, key id, string message) { if (message == "land"  { llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<-.35,-0.003,.943>,ZERO_VECTOR,ZERO_ROTATION,0); llSetTimerEvent(59); } if (message == "launch"  { llResetScript(); } } timer() { // This line will pick the first object out of the container and rez it llRezObject(llGetInventoryName(INVENTORY_OBJECT,0), llGetPos()+<-.35,-0.003,.943>,ZERO_VECTOR,ZERO_ROTATION,0); } }
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-02-2009 15:58
I think what you're looking for is something on the lines of llRezObject(llGetInventoryName(INVENTORY_OBJECT,0) , llGetPos()+< -.35,-0.003,.943 >*llGetRot(),ZERO_VECTOR,ZERO_ROTATION,0); In this context, multiplying the offset < -.35,-0.003,.943 > by llGetRot() at run-time changes it from meaning "so many meters north/south/east/west of me" to "so many meters in front/behind/left/right of me". Or you could look at it as meaning "use the local ruler on the edit window and not the sim one". One gotcha -- always, always calculate the offset with the rezzer angled at ZERO_ROTATION (all the numbers in the Rotation boxes in the edit window set to 0). If you don't, things will go wrong -- I speak from bitter experience.
|
Evo Hak
Registered User
Join date: 30 Apr 2008
Posts: 5
|
09-02-2009 16:22
For some reason this still rezzes the object in its original global rotation. Am I still missing something?
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-02-2009 16:44
From: Evo Hak For some reason this still rezzes the object in its original global rotation. Am I still missing something? Oh.. sorry, I thought we were talking about its position relative to the rezzer. If you mean you want to rotate the object, too, then i think you want llRezObject(llGetInventoryName(INVENTORY_OBJECT,0) , llGetPos()+< -.35,-0.003,.943 >*llGetRot(),ZERO_VECTOR,ZERO_ROTATION*llGetRot(),0); This should ensure the object is always facing towards/away from/left/right of the rezzer.
|
Evo Hak
Registered User
Join date: 30 Apr 2008
Posts: 5
|
09-02-2009 16:46
Thanks. I'm going to try this, and put it in the parent prim with the correct offset. I realized the prim I was trying to put it in was rotated (necessarily so, I might add) on the Y by 180 degrees.
|
Evo Hak
Registered User
Join date: 30 Apr 2008
Posts: 5
|
09-02-2009 17:12
I just don't get it. Now it's rezzing in the same orientation but the position offset is all screwy and gets worse as the rezzer turns further.
I'd appreciate any help.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-02-2009 17:12
Just set it up with the parent prim at ZERO_ROTATION, with the rezzed object aligned to the rezzer as it would be were the rezzer at ZERO_ROTATION. Doesn't matter if they're both on their sides or something.. because, when you put the rezzer the right way up, the rezzed object will preserve the offset and rotation, and end up in the right place relative to the rezzer when the rezzer is rotated as you normally want it.
|
Evo Hak
Registered User
Join date: 30 Apr 2008
Posts: 5
|
09-02-2009 19:48
This isn't working no matter what I try. Thanks for your help anyway.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-03-2009 00:12
Why not post the full code here, and let's see what can be done?
And the other thing.. stupid question, but are you sure ZERO_ROTATION is the rotation you actually want for your rezzed object? That's the only thing I can think of that could be causing a problem. What does it say in the rotation windows in the edit panel when you've got your object correctly positioned relative to the rezzer when the rezzer is at ZERO_ROTATION?
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-03-2009 01:22
From: Innula Zenovka ZERO_ROTATION*llGetRot(),0); wouldn't that just be the same as llGetRot() since you're basically multiplying it by nothing
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-03-2009 05:39
From: Ruthven Willenov wouldn't that just be the same as llGetRot() since you're basically multiplying it by nothing Yes. If it's ZERO_ROTATION, then llGetRot() on its is the same. It's one of those things I always include, though, whether I need it or not, just because I find it simpler to remember always to multiply by llGetRot() if I want to preserve the rezzed object's rotation relative to the rezzer.
|
Rudolf Cleanslate
Registered User
Join date: 1 Dec 2006
Posts: 13
|
09-05-2009 02:45
I have found this all works OK as long as the rezzed object has <0,0,0> rotation relative to the rezzer. As a solution I use a small invisible prim as root of the to-be rezzed object. That small prim has zero rotation , you can tilt/swivel the rest of the object - it will always rezz as expected.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-05-2009 05:46
I wrestled with this for ages till some kind person here explained it to me, and it's not difficult. Orientate your rezzer at < 0.0, 0.0, 0.0 > . Then position the to-be-rezzed object as you want it, at the correct rotation. Let's say that's a cube 1 metre above the rezzer, angled at x = 45.00, y = 324.75 , z = 15.00 (standing on one of its corners, in other words). Now colour or number the sides of both your cubes so you can keep track of how they're aligned. In the rezzer script, either calculate your rezzed object's angle by saying, rotation r = llEuler2Rot( < 45.0,324.75,15.00 > *DEG_TO_RAD); or just drop a script into the rezzed object saying llOwnerSay((string)llGetRot()); and copy paste the result into your rezzer script as rotation r = < 0.32506, -0.32506, 0.00000, 0.88807 > ; However you've calculated the rotation, use the line, llRezAtRoot(my_cube, llGetPos()+ < 0.0, 0.0, 1.0 > *llGetRot() , ZERO_VECTOR, r*llGetRot(), 0) You will then find that, however you rotate the rezzer, the rezzed cube always comes out at the same angle relative to the rezzer.
|
Rudolf Cleanslate
Registered User
Join date: 1 Dec 2006
Posts: 13
|
09-05-2009 14:28
I have wrestled for weeks on this. If it is really that simple, it would be nice if somebody adds this explanation to the LSL Wiki
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
09-05-2009 20:57
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
09-06-2009 06:38
Thank you, Hewee.
|