Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Rezzers Skirt_Rezzer  

Skirt_Rezzer

Skirt_Rezzer

Category: Rezzers
By : Ged Larsen
Created: 2010-12-26 Edited: 2010-12-26
Worlds: Second Life

the Zip file

Download all files for Skirt_Rezzer
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Skirt_Rezzer_1.lsl
1 ////////////////////////////////////////////////////////////////////////////////
2 // LoopRez v0.6, by Ged Larsen, 20 December 2006
3 //
4 // - rez a number of objects in an ellipse, whose size is determined by xRadius and yRadius
5 // - all facing "outwards", along a tangent to the ellipse
6 // - can set how much the objects flare outwards
7 // - properly handles object rotation corrections (for example, X-axis 180 degree rotation helps for flexi-prim skirts)
8 // - can also get a 'saddle' bend, to generate a bend that might help for necklaces (from Ariane Brodie)
9 //
10 // To use:
11 // 1) create a prim that will contain this script and the object to use
12 // 2) put the script into the prim
13 // 3) create an object that will be used, and name it "Object"
14 // 4) put "Object" into the prim containing the script, by dragging it from your inventory
15 // 5) get out of Edit Mode, and touch the prim
16 //
17 // Random note:
18 // - this version does NOT insure equal spacing of objects along the perimeter of the ellipse
19 // - i.e., objects "bunch up" at the long ends of an ellipse; the effect should be acceptable for non-extreme ellipses
20 // - even spacing of objects can be accomplished, but requires simulation of integral calculus, which slows down the script
21 //
22 // References:
23 // - tangent formulas from: http://mathworld.wolfram.com/Ellipse.html
24
25
26 ////////////////////////////////////////////////////////////////////////////////
27 // CONFIGURATION PARAMETERS, change these to your liking
28
29 string objectName = "flap"; // object to use; will need to be in the inventory of the prim containing this script
30 integer numObjects = 12; // how many objects
31 float xRadius = 0.16; // ellipse x-axis radius in meters
32 float yRadius = 0.32; // ellipse y-axis radius in meters
33 float flareAngle = 30.0; // how many DEGREES the bottom of object will flare outwards, the "poof" factor
34 float bendCoefficient = 0.0; // makes a "saddle shape", bends DOWN this number of meters at extremes of X-axis
35 vector rotOffset = <0.0, 180.0, 0.0>; // rotation offset in DEGREES -- fixes the rotation of ALL objects; for flexi prims, often you will want <180.0,>
36 vector posOffset = <0.0, 0.0, 2.0>; // position offset
37
38
39
40 ////////////////////////////////////////////////////////////////////////////////
41 // No need to mess with anything below here
42
43 makeLoop()
44 {
45 integer n; // which object is being placed
46 float theta; // angle in radians
47 vector pos; // position
48 rotation rot; // rotation in quaternionformat
49
50 for(n = 0; n < numObjects; n++) {
51
52 theta = TWO_PI * ( (float)n / (float)numObjects );
53
54 pos.x = xRadius * llCos(theta); // ellipse: 2x xRadius meters wide
55 pos.y = yRadius * llSin(theta); // ellipse: 2x yRadius meters wide
56 pos.z = -bendCoefficient*llCos(theta)*llCos(theta); // saddle shape, bending downwards on X-axis
57 pos = pos + llGetPos() + posOffset;
58
59 rot = llEuler2Rot(<rotOffset.x*DEG_TO_RAD, rotOffset.y*DEG_TO_RAD, rotOffset.z*DEG_TO_RAD>); // user-chosen rotation offset correction
60 rot = rot * llEuler2Rot(<0, -1*flareAngle*DEG_TO_RAD, 0>); // flare generation (poof)
61
62 // the following make the objects face outwards properly for an ellipse; using theta alone is only correct for a circle
63 // the scary formula calculates a unit vector TANGENTIAL to the ellipse, and llRotBetween is used to figure out how much the object needs to rotate to lie parallel to the tangent
64 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>);
65 if( n== (numObjects/2) ) // LSL's implementation of llRotBetween at theta = pi radians is reversed at 180 degrees, so this manually corrects it
66 rot = rot * llEuler2Rot( <0,PI,0> );
67
68 llRezObject(objectName, pos, ZERO_VECTOR, rot, 0);
69 }
70 }
71
72 default
73 {
74 touch_start(integer total_number)
75 {
77 {
78 makeLoop();
79 }
80 }
81 }

Back to the Best Free Tools in Second Life and OpenSim.