Advertisement
Guest User

Untitled

a guest
Aug 6th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. integer OPEN = FALSE;
  2. integer MOVING = FALSE;
  3. rotation startRot;
  4.  
  5. default
  6. {
  7. state_entry()
  8. {
  9. llSetStatus(STATUS_BLOCK_GRAB_OBJECT,TRUE);
  10. llSetKeyframedMotion( [ZERO_VECTOR,ZERO_ROTATION,1.0], [] );
  11. }
  12.  
  13. touch_start(integer total_number)
  14. {
  15. if(!MOVING)
  16. {
  17. if(OPEN)
  18. {
  19. OPEN = FALSE;
  20. MOVING = TRUE;
  21. llSetKeyframedMotion( [ZERO_VECTOR,llEuler2Rot(<0,0,-90>*DEG_TO_RAD),1.0], [] );
  22. }
  23. else
  24. {
  25. OPEN = TRUE;
  26. MOVING = TRUE;
  27. startRot = llGetRot();
  28. llSetKeyframedMotion( [ZERO_VECTOR,llEuler2Rot(<0,0,90>*DEG_TO_RAD),1.0], [] );
  29. }
  30. }
  31. }
  32. moving_end()
  33. {
  34. MOVING = FALSE;
  35. if(OPEN)
  36. {
  37. vector startRotVector = llRot2Euler(startRot)*RAD_TO_DEG;
  38. llSetLinkPrimitiveParamsFast(LINK_ROOT,[PRIM_ROTATION,llEuler2Rot((startRotVector+<0,0,90>)*DEG_TO_RAD)]);
  39. }
  40. else
  41. {
  42. llSetLinkPrimitiveParamsFast(LINK_ROOT,[PRIM_ROTATION,startRot]);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement