Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzing objects based on rotaion of base

Lunar Tripsa
Registered User
Join date: 2 Feb 2007
Posts: 38
10-29-2007 10:45
Okay, I'm working on a rezzer and having so much fun with it, till I realized a flaw.

I have a single prim that when clicked gives a menu of items to rez. It all works fine, except that if the base is rotated the objects that are then rezzed, of course aren't rotated in relation to the base. The object has a front, so it's important to be able to make it face in the best direction for it's use.

I've seen other post with similar issues, but since I'm not a scripter I haven't been able to adapt their solutions to my script (although I've spent about a week trying to work it out).

I'm using this to rez objects currently:
llRezObject("wizard", llGetPos() + (<0.0, 0.0, 2.6> * llGetRot()),<0,0,0>, llGetRot(), 0);

Any help would be very much appricated.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-29-2007 11:11
that rez code works for me, at any angle....

the only (non)difference between what you wrote and what I use is mine looks like

llGetPos() + vVecOffset * llGetLocalRot()

vs your

llGetPos() + (<0.0, 0.0, 2.6> * llGetRot())

two things to check...
is the rez script in the root prim?
if not, is the root prim rotated in relation to the rezzor prim?
_____________________
|
| . "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...
| -
Lunar Tripsa
Registered User
Join date: 2 Feb 2007
Posts: 38
10-29-2007 11:21
The rez scipt is in the root prim and it's a single prim.

If I rotate the base prim the objects it rezzes are still in the same place as if I hadn't rotated the base before rezzing them. Sorry I'm having a hard time making sure I have the voc right with all this.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-29-2007 15:18
From: Lunar Tripsa
The rez scipt is in the root prim and it's a single prim.

If I rotate the base prim the objects it rezzes are still in the same place as if I hadn't rotated the base before rezzing them. Sorry I'm having a hard time making sure I have the voc right with all this.

hmm try using localRot, if that doesn't get it, then post the rest of the code?
_____________________
|
| . "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...
| -
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
10-29-2007 15:31
Hehe. Void just beat me to it. I was also going to suggest that you try localRot but having tried your code exactly as written I can confirm that it works for me. Regardless of rotation the object "wizard" is rezzed + 2.6m on the z axis of the rezzing object. e.g. It does what it says on the tin.

If your still having trouble post the rest of your code so we can see it in context.
_____________________
Tread softly upon the Earth for you walk on my face.
Lunar Tripsa
Registered User
Join date: 2 Feb 2007
Posts: 38
10-29-2007 17:37
yes, the code does exactly what it should. Rez an object at a certain point.

I just tried llGetLocalRot and that does move the piece being rezzed, but it doesn't orient completely. I'm really confused at this point. I guess because I'm dealing with 2 rotations the items and the axis (not sure that's the term I want).

If it would help for me to show you in world I'd be happy to compinsate for your time.

CODE

list SnowMan = ["Noses"];
list Noses = ["Carrot1"];

string massage = "SnowMan";

integer channel;
integer menu_handler;
vector openPos = ZERO_VECTOR;
rotation openRot = ZERO_ROTATION;
vector openScale = ZERO_VECTOR;

default
{
state_entry()
{
channel = (integer)(llFrand(99999.0) * -1);

menu_handler = llListen(channel,"","","");
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "Select on option!", SnowMan, channel);
}
listen(integer channel, string name, key id, string message)
{
if (message == "Noses")
llDialog(id, "Choose", Noses, channel);
if(message == "Carrot1")
{
llDialog(id, "Choose", Noses, channel);
string object_to_rez = llGetInventoryName(INVENTORY_OBJECT,0);
llSay(55, "derezhat");
vector modVec = <90,90, 90.0>;
modVec *= DEG_TO_RAD;
rotation modRot = llEuler2Rot(modVec);
rotation newRot= llGetRot() * modRot;
llRezObject("carrot1", llGetPos() + (<0.031, 0.700, 2.115> * llGetLocalRot() ), ZERO_VECTOR,newRot, 42);
}
}

on_rez(integer start_param)
{
llResetScript();
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-30-2007 02:44
so you're saying that the new object rezzes in the right Position, but not at the right Rotation?

ok, assuming the base has zero rotation (for testing)
rezz a copy of the object(carrot) From Inventory,
place it roughly where it would go,
rotate it to how you'd like it to be,
then in the edit window for the carrot, write down the rotations.

in your code replace
vector modVec = <90,90, 90.0>;
with
vector modVec = <x, y, z>;
from the edit window...

then (IIRC) replace the line
rotation newRot= llGetRot() * modRot; //-- this rotates around global axis
with
rotation newRot= modRot * llGetRot(); //-- this rotates around local axis
_____________________
|
| . "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...
| -
Lunar Tripsa
Registered User
Join date: 2 Feb 2007
Posts: 38
10-30-2007 10:28
Oh that must have been it!!!

Almost all the objects being rezzed are working perfectly now, although I still have a couple that aren't. In those cases the position rez fine when the base is at 0 rotation, but when the base is rotated the position on several rezzed items isn't correct.

I tried GetLocalPos, but that didn't seem to do anything.
If the item being rezzed has a x and y corordinate other then 0 then in some case rezzs off. Others rezz correctly.