Jump to content

SpringFling

Resident
  • Posts

    3
  • Joined

  • Last visited

Posts posted by SpringFling

  1. Below is the script infomation for rotation.  I have tried to change all the rotations and yet it still swings like a playground swing and I need it to swing like a hammock...if anyone knows how to change the below script to swing like a hammock please help!

     

     

     

    integer i=1; float swingRad; vector normal;

    rotation Inverse(rotation r) {     r.x = -r.x;     r.y = -r.y;     r.z = -r.z;     return r; } rotation GetParentRot() {     return Inverse(llGetLocalRot())*llGetRot();  } SetLocalRot(rotation x) {     llSetRot(x*Inverse(GetParentRot())); }

    default {     state_entry()     {         normal = llRot2Euler(llGetRot());         swingRad=DEG_TO_RAD*swingDegrees;         llSetTouchText("Swing");     }     touch_start(integer num)     {         if(swing)         {             swing=FALSE;             llSetTouchText("Swing");         }         else         {             swing=TRUE;             llSetTouchText("Stop swing");             llSetTimerEvent(time);         }     }     timer()     {         float stepOffset=(float)i/steps*TWO_PI;         if(i>steps) i=1;         if(swing==FALSE && (i==steps || i==steps/2))         {             llSetTimerEvent(0.0);             SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z + swingRad*llSin(stepOffset)>));         } else         {             SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z + swingRad*llSin(stepOffset)>));             i++;         }     }     moving_end()     {         normal=llRot2Euler(llGetRot());     } }

  2. I have a swing script that I purchased from Marketplace and I cannot figure out how to edit it in order to change the rotation to use it with a hammock.  Below is the script...if anyone knows what needs to be changed so that it will swing like a hammock please let me know

    integer i=1; float swingRad; vector normal;

    rotation Inverse(rotation r) {     r.x = -r.x;     r.y = -r.y;     r.z = -r.z;     return r; } rotation GetParentRot() {     return Inverse(llGetLocalRot())*llGetRot();  } SetLocalRot(rotation x) {     llSetRot(x*Inverse(GetParentRot())); }

    default {     state_entry()     {         normal = llRot2Euler(llGetRot());         swingRad=DEG_TO_RAD*swingDegrees;         llSetTouchText("Swing");     }     touch_start(integer num)     {         if(swing)         {             swing=FALSE;             llSetTouchText("Swing");         }         else         {             swing=TRUE;             llSetTouchText("Stop swing");             llSetTimerEvent(time);         }     }     timer()     {         float stepOffset=(float)i/steps*TWO_PI;         if(i>steps) i=1;         if(swing==FALSE && (i==steps || i==steps/2))         {             llSetTimerEvent(0.0);             SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z + swingRad*llSin(stepOffset)>));         } else         {             SetLocalRot(llEuler2Rot(<normal.x, normal.y, normal.z + swingRad*llSin(stepOffset)>));             i++;         }     }     moving_end()     {         normal=llRot2Euler(llGetRot());     } }

×
×
  • Create New...