Technique -
Scripts
|
Écrit par ssm2017
|
Jeudi, 15 Novembre 2007 04:37 |
petite astuce pratique pour faire effectuer une rotation locale a un objet selon un angle.
// @copyright Copyright (C) 2007 ssm2017 Binder (S.Massiaux). All rights reserved.
// @license GNU/GPL, http://www.gnu.org/licenses/gpl-2.0.html
// ssm2017_authdoor_diaph is free software. This version may have been modified pursuant to the
// GNU General Public License, and as distributed it includes or is derivative
// of works licensed under the GNU General Public License or other free or open
// source software licenses.
integer angle = 150;
integer opened = FALSE;
rotation start_rot;
default
{
on_rez(integer num)
{
llResetScript();
}
state_entry()
{
start_rot = llGetRot();
llListen(0, "", "", "reset");
}
touch_start(integer num_detected)
{
if ( opened )
{
llSetRot(start_rot);
opened = FALSE;
}
else
{
llSetRot(llEuler2Rot(<0, 0, angle * DEG_TO_RAD>) * start_rot);
opened = TRUE;
}
}
listen( integer channel, string name, key id, string message )
{
llWhisper(0,"reset");
llResetScript();
}
}
|