Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer OPEN = FALSE;
- integer MOVING = FALSE;
- rotation startRot;
- default
- {
- state_entry()
- {
- llSetStatus(STATUS_BLOCK_GRAB_OBJECT,TRUE);
- llSetKeyframedMotion( [ZERO_VECTOR,ZERO_ROTATION,1.0], [] );
- }
- touch_start(integer total_number)
- {
- if(!MOVING)
- {
- if(OPEN)
- {
- OPEN = FALSE;
- MOVING = TRUE;
- llSetKeyframedMotion( [ZERO_VECTOR,llEuler2Rot(<0,0,-90>*DEG_TO_RAD),1.0], [] );
- }
- else
- {
- OPEN = TRUE;
- MOVING = TRUE;
- startRot = llGetRot();
- llSetKeyframedMotion( [ZERO_VECTOR,llEuler2Rot(<0,0,90>*DEG_TO_RAD),1.0], [] );
- }
- }
- }
- moving_end()
- {
- MOVING = FALSE;
- if(OPEN)
- {
- vector startRotVector = llRot2Euler(startRot)*RAD_TO_DEG;
- llSetLinkPrimitiveParamsFast(LINK_ROOT,[PRIM_ROTATION,llEuler2Rot((startRotVector+<0,0,90>)*DEG_TO_RAD)]);
- }
- else
- {
- llSetLinkPrimitiveParamsFast(LINK_ROOT,[PRIM_ROTATION,startRot]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement