Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Builder's Brewery
- // Smooth sliding door
- // One-way sliding, linkable door
- vector MoveOnLocalGrid;
- float TimeItTakesForDoorToOpen;
- integer Direction;
- init()
- {
- MoveOnLocalGrid = <1.0,0.0,0.0>;
- TimeItTakesForDoorToOpen = 2.0;
- Direction = 1;//do not change, toggles between +1 and -1
- }
- operateDoor()
- {
- vector PositionBeforeMovement = llGetLocalPos();
- vector VectorForDoorMovement = Direction*MoveOnLocalGrid*llGetLocalRot();
- float i;
- llResetTime();
- do
- {
- i = llGetTime()/TimeItTakesForDoorToOpen;
- llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION,PositionBeforeMovement + i*VectorForDoorMovement]);
- }
- while (llGetTime() < TimeItTakesForDoorToOpen && i <= 1.0);
- llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_POSITION,PositionBeforeMovement + VectorForDoorMovement]);
- Direction *= -1;
- }
- default
- {
- on_rez(integer start_param)
- {
- llResetScript();
- }
- state_entry()
- {
- init();
- }
- touch_start (integer num_detected)
- {
- operateDoor();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement