​
list boutons_pos = ["x+", "y+", "z+","x-","y-","z-","ROTATION", "STOP","RESET"];
list boutons_rot = ["Rx+", "Ry+", "Rz+","Rx-","Ry-","Rz-","POSITION", "STOP","RESET"];
list menu_princip = ["POSITION","ROTATION","STOP"];
string Info = "Choisissez une option";
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
+ llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
vector pos;
vector pos_init;
rotation rot;
rotation rot_init;
key ID;
integer canal;
integer handler;
default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
ID = llGetOwner();
canal = (integer)("0xA" + llGetSubString((string)ID, 0,6 ));
pos_init = llGetLocalPos();
rot_init = llGetLocalRot();
}
touch_start(integer num_detected)
{
llListenRemove(handler);
handler = llListen(canal, "",ID, "");
llDialog(ID, Info, order_buttons(menu_princip), canal);
llSetTimerEvent(30.0);
}
listen(integer channel, string name, key id, string message)
{
pos = llGetLocalPos();
rot = llGetLocalRot();
if (message == "STOP")
{
llListenRemove(handler);
llSetTimerEvent(0.0);
}
else if(message == "POSITION")
{
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message == "ROTATION")
{
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message == "RESET")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos_init]);
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot_init]);
llListenRemove(handler);
llSetTimerEvent(0.0);
}
else if(message =="x+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION,pos+<0.01,0.0,0.0>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="y+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos+<0.0,0.01,0.0>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="z+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos+<0.0,0.0,0.01>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="x-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos-<0.01,0.0,0.0>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="y-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos-<0.0,0.01,0.0>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="z-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POS_LOCAL,pos-<0.0,0.0,0.01>]);
llDialog(ID, Info, order_buttons(boutons_pos), canal);
}
else if(message =="Rx+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<1.0,0.0,0.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message =="Ry+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<0.0,1.0,0.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message =="Rz+")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<0.0,0.0,1.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message =="Rx-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<-1.0,0.0,0.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message =="Ry-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<0.0,-1.0,0.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
else if(message =="Rz-")
{
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROT_LOCAL,rot*llEuler2Rot(<0.0,0.0,-1.0>*DEG_TO_RAD)]);
llDialog(ID, Info, order_buttons(boutons_rot), canal);
}
}
timer()
{
llSay(0,"Temps écoulé, veuillez recliquer...");
llListenRemove(handler);
llSetTimerEvent(0.0);
}
}
Il faut verifier que le mesh est cliquable, sinon, rajouter un prim à cliquer....