I'm making a gadget that rezzes a newt each time it is touched. So far it's working ok, with one notable exception - the location of the rezzed newt. It's fine if I have the emitter oriented in one specific direction, but if it's facing in any other direction, the newt is rezzed in the wrong place.
Now, I'm thinking that the answer will likely involve llRot2Fwd in some way. But I'm rather math-challenged, and for the life of me I can't figure out exactly how to set it up so that the newt is rezzed in the same position *relative to the emitter*, regardless of emitter placement.
Here's the current version of the rezzer script I've written:
default
{
state_entry()
{
}
touch_start(integer total_number)
{
vector eulbubble = <0,0,90>;
eulbubble *= DEG_TO_RAD;
rotation rotbubble = llEuler2Rot(eulbubble);
vector eulnewt = <-90,270,0>;
eulnewt *= DEG_TO_RAD;
rotation rotnewt = llEuler2Rot(eulnewt);
llMessageLinked(LINK_SET, 0, "zotness", NULL_KEY);
llSleep(0.5);
llTriggerSound("Zot!", 1);
llRezObject("zot bubble", llGetPos() + <0, 1, 0>, ZERO_VECTOR, rotbubble, 42);
llSleep (1.5);
llRezObject("Newt", llGetPos() + <0, 1, 0>, ZERO_VECTOR, rotnewt, 42);
}
}
How can I rewrite it so that the newt (and the "zot bubble" effect) are always rezzed in the same position and orientation relative to the emitter box?
