Advertisement
itoibo

Door Slider

Jan 9th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. //When touched the prim is retracted towards one end and when touched again stretched back out.
  2. //
  3. //Prim moves/changes size along the local coordinate specified in the offset vector below.
  4. //
  5. //To change the overall size, edit the prim when stretched out and reset the script when done.
  6. //
  7. //The script works both in unlinked and linked prims.
  8. //
  9. // Copyright (C) 2008 Zilla Larsson
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License version 3, as
  12. // published by the Free Software Foundation.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>
  21.  
  22.  
  23. vector offset = <1,0,0>; //Prim moves/changes size along this local coordinate
  24. float hi_end_fixed = FALSE; //Which end of the prim should remain in place when size changes?
  25. //The one with the higher (local) coordinate?
  26. float min = 0.2; //The minimum size of the prim relative to its maximum size
  27. integer ns = 10; //Number of distinct steps for move/size change
  28.  
  29.  
  30. default {
  31. state_entry() {
  32. offset *= ((1.0 - min) / ns) * (offset * llGetScale());
  33. hi_end_fixed -= 0.5;
  34. }
  35.  
  36. touch_start(integer detected) {
  37. integer i;
  38. do llSetPrimitiveParams([PRIM_SIZE, llGetScale() - offset,
  39. PRIM_POSITION, llGetLocalPos() + ((hi_end_fixed * offset) * llGetLocalRot())]);
  40. while ((++i) < ns);
  41. offset = - offset;
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement