Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Opensim - Door Rot90°
#1
Lightbulb 
Open close Door


Create box and edit objet

change "seize"
x = 0.09
y = 2.90
z = 3.50

change "rotate"
x = 90.0
y = 0
z = 0


change "start end tranche"
D = 0.500 F = 1.000




Code:
float       TIMER_CLOSE = 15.0;      
integer     DIRECTION   = -1;      
integer     DOOR_OPEN   = 1;
integer     DOOR_CLOSE  = 2;
vector      originalPos;      

door(integer what)
{
    rotation    rot;
    rotation    delta;
    vector eul;
    
    llSetTimerEvent(0);
    
    if ( what == DOOR_OPEN )
    {
     //   llTriggerSound("doorOpen", 1);  
        eul = <0,  90*DIRECTION,0>; //90 degrees around the z-axis, in Euler form
          
    } else if ( what == DOOR_CLOSE)
    {
     //   llTriggerSound("doorClose", 1);  
        eul = <0,  90*-DIRECTION,0>; //90 degrees around the z-axis, in Euler form

    }

    eul *= DEG_TO_RAD; //convert to radians rotation
    rot = llGetRot();
    delta = llEuler2Rot(eul);
    rot = delta * rot;                  
    llSetRot(rot);
}


default
{  
    on_rez(integer start_param)

    {   llResetScript();     }
        

    touch_start(integer total_number)

    {
        door(DOOR_OPEN);
        state open_state;    
    }

    
    moving_end()

    {  
        originalPos = llGetPos();
    }
}


state open_state
{

    touch_start(integer num)

    {
        door(DOOR_CLOSE);
  //      llSetPos(originalPos);            
        state default;

    }

    moving_start()

    {
        door(DOOR_CLOSE);
        state default;
    }
}
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  script Opengrid - avatar key and name speaker trainz 1 907 12-14-2011, 05:21 AM
Last Post: Anarchist_Labs
Photo Script Opensim - Texture Carte Map trainz 1 915 12-14-2011, 05:18 AM
Last Post: Anarchist_Labs
Star Script OPENGRID - Paticle Fire Orange trainz 1 1,143 11-12-2011, 04:04 AM
Last Post: LordJames
  Script Opensim - Texture UUID trainz 0 829 11-05-2011, 08:59 PM
Last Post: trainz
Brick Script opengrid - sim info trainz 0 790 11-05-2011, 08:31 PM
Last Post: trainz
Lightbulb Script opengrid - Door with password trainz 0 759 11-05-2011, 08:02 PM
Last Post: trainz
Bug script opengrid - Land info script trainz 0 770 11-05-2011, 07:54 PM
Last Post: trainz
  Script Opengrid - Group inviter trainz 0 706 11-05-2011, 07:41 PM
Last Post: trainz
Music Script Opengrid - Parcel Audio System trainz 0 536 11-05-2011, 07:30 PM
Last Post: trainz
Rainbow Script Opengrid - Teleport collision trainz 0 525 11-05-2011, 12:44 PM
Last Post: trainz



Users browsing this thread: 1 Guest(s)