Advertisement
Jym_Nova

Rez and Wrap in a circle

Jun 16th, 2015
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written By: Ĵyм Ѡҩℓƒ (Jym Resident)
  2. /*
  3. LICENCE:
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. or you may visit - http://license.idjhost.com/
  17. */
  18. // DESCRIPTION
  19. // Rez items in a circle around the root prim
  20.  
  21. string objectName = "Object";
  22. integer rezTen = 10;
  23. float xRadius = 0.64;
  24. float yRadius = 0.64;
  25. float flareAngle = 0.0;
  26. float bendCoefficient = 0.0;
  27. vector rotOffset = <0.0, 180.0, 0.0>;
  28. vector posOffset = <0.0, 0.0, 1.0>;
  29.  
  30. makeTen(){
  31.     integer n;
  32.     float theta;
  33.     vector pos;
  34.     rotation rot;
  35.  
  36.     for(n = 0; n < rezTen; n++) {
  37.         theta = TWO_PI * ( (float)n / (float)rezTen );
  38.  
  39.         pos.x = xRadius * llCos(theta);
  40.         pos.y = yRadius * llSin(theta);
  41.         pos.z = -bendCoefficient*llCos(theta)*llCos(theta);
  42.         pos = pos + llGetPos() + posOffset;
  43.  
  44.         rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>);
  45.         rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>);
  46.         rot = rot * llRotBetween(<0.0,1.0,0.0>, <-1.0 * xRadius * llSin(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),yRadius * llCos(theta) / ( llSqrt ( (yRadius*yRadius * llCos(theta) * llCos(theta)) + (xRadius*xRadius * llSin(theta) * llSin(theta))) ),0.0>);
  47.         if ( n== (rezTen/2) )
  48.         rot = rot * llEuler2Rot( <0,PI,0> );
  49.  
  50.         llRezObject(objectName, pos, ZERO_VECTOR, rot, 0);
  51.     }
  52. }
  53.  
  54. default{
  55.     on_rez(integer r){
  56.         llResetScript();
  57.     }
  58.     touch_start(integer total_number){
  59.         if (llDetectedKey(0) == llGetOwner()){
  60.         makeTen();
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement