Jump to content

A way to make the door open and close more slowly with this script?


lucagrabacr
 Share

You are about to reply to a thread that has been inactive for 3525 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Yes, don't use that ancient, clunky door script. If you want a door to open slowly, you have two choices:

1. Use a script that swings the door in slow, incremental steps and, at the same time, rotates it with llTargetOmega.  That way, the servers do the actual work of opening the door and your viewer does the pretty part of making the motion appear smooth.  Take a look at http://wiki.secondlife.com/wiki/Smooth_Rotating_Door

2.  The other approach is to use llKeyframedMotion, which was designed just for situations like this.  You can open and close the door with a single KFM function.

  • Like 1
Link to comment
Share on other sites

Hi :)   I wont try to fix your script  but ill give you one of mine for slow open and close. Just cut and paste as new script

//Darleen Emerald Feb 2011

// Make the door........(prim size 0.3,5.0,4.0)  (set prim rot to 180,0,90)  (set path cut to 0.375,0.875)

//  Note  on  prim rotation....right side=180,0,90  or  left side= 0,0,270

// Note....Set door prim to the GROUP  that is allowed entry  door is locked for all others

// add sound files  to contents "Door open" and  "Door close"


integer vgIntDoorSwing = 2;//dont change this value
rotation vgRotDoorSwing;
float speed = 0.04;//   **********Adjust this value to desired open and close speed ************
default
{
    state_entry()
    {
        vgRotDoorSwing = llEuler2Rot( <.0, .0, (float)vgIntDoorSwing * DEG_TO_RAD> );
    }

    touch_start( integer vIntTouches )
    {
        if(llSameGroup(llDetectedKey(0)))
        {

            
            if(vgIntDoorSwing > 0) llPlaySound("Door open",1.0);
            integer a = 0;
            integer b = 45;
            for(; a < b; ++a)
            {
                vgRotDoorSwing = llEuler2Rot( <.0, .0, (float)vgIntDoorSwing * DEG_TO_RAD> );
                
                 llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION,(vgRotDoorSwing * llGetLocalRot())]);
                 llSleep(speed);//was 0.02
            }
            if(vgIntDoorSwing < 0) llPlaySound("Door close",1.0);
            vgIntDoorSwing =  vgIntDoorSwing * -1;
            if(vgIntDoorSwing < 0) llSetTimerEvent(30);
        }
        else
        {
            llSay(0," Door is locked");
        }
    }
    timer()
    {
        if(vgIntDoorSwing > 0)
        {
            llSetTimerEvent(0);
            return;
        }
        integer a = 0;
        integer b = 45;
        for(; a < b; ++a)
        {
            vgRotDoorSwing = llEuler2Rot( <.0, .0, (float)vgIntDoorSwing * DEG_TO_RAD> );
            
            llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION,(vgRotDoorSwing * llGetLocalRot())]);
                 llSleep(speed);//was 0.02
        }
        llPlaySound("Door close",1.0);
        vgIntDoorSwing =  vgIntDoorSwing * -1;
        llSetTimerEvent(0);
    }
}

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3525 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...