I want to rez an object, say a hottub, in the corner of a floor prim of a house which could have any arbitrary rotation.
Only script 4 and 5 rez with correct location and rotation but if I turn the prim the object rezzes in the same location regardless of which rotation the rezzing prim is.
I have used previous examples from this forum and have spent at least 50 hours and a couple of months (on and off) on this so, as always, my last resort is to ask for help. I have made a very serious attempt in the last couple of days but it eludes me. I've probably missed or screwed one that does work. Please correct one of these for me. I'm sure others could benefit too.
Also if you could point out the major problem other than Rotations are a PITA.
I thank you for even looking.
I have placed 5 test prims setup here @ http://slurl.com/secondlife/Bangu/238/198/501 They can be copied and abused and have full perms.
CODE
//test script1
vector Angle = <0,0,53>; //Enter a vector rotation
rotation quat; //your rotation converted to quat
vector pos;
default
{
state_entry()
{ llSay(0, " Is ready");
pos = <1,1,1>;
vector eul = Angle; // in Euler form..
eul *= DEG_TO_RAD; //convert to radians...
rotation quat = llEuler2Rot( eul ); //convert to quaternion..
}
touch_start(integer total_number)
{
llSay(-565651,"remove");
llSleep(1);
llRezObject("Test1", llGetPos() + pos, <0,0,0>, quat,42); //quat inserted
}
//THIS ONE IS JUST PLAIN BROKEN!
CODE
//test script2
integer rot;
rotation dorot;
vector pos;
default
{
state_entry()
{
llSay(0, " Is ready");
vector pos = <1,1,1>;
rotation rot = <0,0,53,1>;
}
touch_start(integer total_number)
{
llSay(-565652,"remove");
llSleep(1);
llRezObject("Test",llGetPos()+ pos, <0,0,1>,<0,0,0>,llSetRot()*<0,0,rot,1>, 0);
}
}
CODE
//test script3
integer rot;
rotation dorot;
vector pos;
default
{
state_entry()
{
llSay(0, " Is ready");
rot = 53;
pos = <1,1,1>;
llSay(0, "Ready!");
}
touch_start(integer total_number)
{
llSay(-565653,"remove");
llSleep(1);
llRezObject("Test3", llGetLocalPos() + pos, <0,0,0>,<0,0,rot,1>,0) ;
}
}
CODE
//test script4
vector rot;
rotation dorot;
vector pos;
default
{
state_entry()
{
llSay(0, " Is ready");
pos= <1,1,1>;
rot= <0,0,53>;
dorot = llGetLocalRot() * llEuler2Rot(rot * DEG_TO_RAD);
}
touch_start(integer total_number)
{
llSay(-565654,"remove");
llSleep(1);
llRezObject("Test4",llGetLocalPos()+pos,<0,0,0>,llGetLocalRot()+<0,0,0,1>*dorot,0) ;
}
}
CODE
//test script5
vector rot;
rotation dorot;
vector pos;
default
{ state_entry()
{
llSay(0, " Is ready");
rot= <0,0,53>;
dorot = llGetRot() * llEuler2Rot(rot * DEG_TO_RAD);
pos = <1,1,1>;
}
touch_start(integer total_number)
{
llSay(-565655,"remove");
llSleep(1);
llRezObject("Test5",llGetPos()+pos,<0,0,0>,<0,0,0,1>*dorot,0) ;
}
}