I'm trying to set a certain rotation to a linked prim. So far i put a script into the root prim that sends a linked message to the linked prim I want to rotate. I want this prim to rotate, wait, then rotate to the default position.
To find out about the degrees I want to rotate, I manually rotated the prim and wrote down the numbers.
Then I tried something like this (this is the script in the prim that gets rotated):
//begin script
rotation Inverse(rotation r)
{
r.x = -r.x;
r.y = -r.y;
r.z = -r.z;
return r;
}
vector CloseRot = <0.0, 270.0, 2750.0>;
vector OpenRot = <0.0, 270.0, 264.0>;
rotation open_rot;
rotation close_rot;
integer open = FALSE;
default
{
state_entry()
{
open_rot = llEuler2Rot((DEG_TO_RAD * OpenRot));
close_rot = llEuler2Rot((DEG_TO_RAD * CloseRot));
}
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "open"

{
llSetPrimitiveParams([PRIM_ROTATION, open_rot * Inverse(Inverse(llGetLocalRot())*llGetRot())]);
}
if (str == "close"

{
llSetPrimitiveParams([PRIM_ROTATION, close_rot * Inverse(Inverse(llGetLocalRot())*llGetRot())]);
}
}
}
// end script
However, I set the correct rotations, I previously found out about by manually rotating the prim into the desired position. But the script does not seem to set the correct rotation, even though I used the same degrees.
Maybe there is a better way to do this? Most important is, that setting the rotation to this prim even works when manually rotating the whole object.
Any help appreciated. THANKS!