Hi,
I've got this script which will rotate and move a prim in relation to the root prim that it's linked to.
The script works perfectly most of the time. However as soon as I attach the object to an av's hand the rotation goes wierd .
Wasn't sure if this is in any way related to the targetomega bug or just something I'm doing wrong.
The script is below:
vector r_open = <210, 0, 0>; // Rotations in degrees relative to root prim
vector r_closed = <0, 0, 180>;
vector p_open = <0, 0.128, 00.038>; // Postition in meters relative to root prim
vector p_closed = <0, 0.03, 0.021>; // Postition in meters relative to root prim
key sound = "0a0b403e-7e30-a2b5-eb3b-bc1395402579"; // the UUID of the sound the wings will make opening or closing.
integer close_on_rez = FALSE; // Change to false to have it open on rez
// ======================================================= Nothing from here down needs modding (unless you're chaning the command this script responds to).
rotation LocalRot(rotation localrot)
{
rotation LocRot = localrot / ( (ZERO_ROTATION / llGetLocalRot()) * llGetRot());
return LocRot;
}
open()
{
llTriggerSound(sound,1.0);
llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_open * DEG_TO_RAD)), PRIM_POSITION, p_open]);
}
close()
{
llTriggerSound(sound,1.0);
llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_closed * DEG_TO_RAD)), PRIM_POSITION, p_closed]);
}
default
{
state_entry()
{
if (close_on_rez)
{
close();
}
else
{
open();
}
}
on_rez(integer rez)
{
llResetScript();
}
link_message(integer send, integer num, string msg, key id)
{
if ( msg == "tricorder_open" )
{
open();
}
else if ( msg == "tricorder_close" )
{
close();
}
}
}