Want to add a script or a project? Upload it and a half million people will see it and your name here this year.
![]() |
![]() |
||
---|---|---|---|
Category: | Contributor: | Creator | |
Building | Shine Renoir | Geodesic_Dome_Builder |
Category: Building
By : Shine Renoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life
Browse the Zip file
12 // Dome Builder3 // 2007 Copyright by Shine Renoir (fb@frank-buss.de)4 // Use it for whatever you want, but keep this copyright notice5 // and credit my name in notecards etc., if you use it in6 // closed source objects78 integer subdivision = 2;9 float length = 3.0;1011 vector base;12 float r;1314 move(vector destination)15 {16 // llSetPos is limited to 10m distances,17 // so it is called until the target is reached18 vector p = ZERO_VECTOR;19 while(p.z != destination.z) {20 llSetPos(destination);21 p = llGetPos();22 }23 }2426 {27 vector line = v2 - v1;28 vector pos = base + line / 2 + v1;30 vector size = <0.1, 0.1, len>;31 vector up = <0, 0, 1>;33 move(pos);34 llRezObject("Line", pos, ZERO_VECTOR, rot, 0);36 }3739 {40 // assuming a normal triangle: no zero area4142 // make v1-v3 the longest side43 integer i = 0;44 for (i = 0; i < 2; i++) {48 if(a > b || c > b) {49 vector tmp = v1;50 v1 = v2;51 v2 = v3;52 v3 = tmp;53 }54 }5556 // calculate side lengths6061 // b=b1+b2, a^2=h^2+b2^2, c^2=b1^2+h^2, solving:62 float b2 = (a*a + b*b - c*c)/2.0/b;63 float b1 = b - b2;6566 // calculate triangle height vector and shear value67 float hPosition = b1 / b;68 vector vb1 = (v3 - v1) * hPosition;69 vector vh = v2 - (v1 + vb1);70 float shear = hPosition - 0.5;7172 // calculate position and rotation73 vector pos = base + v1 + (v3 - v1) / 2 + vh / 2;74 vector size = <b, 0.05, h>;75 vector up = <0.0, 0.0, 1.0>;79 left = llVecNorm(left % fwd); // "left" is cross product (orthogonal to base and left)80 rot = llAxes2Rot(fwd, left, fwd % left); // calculate the needed rotation8182 // create object83 llRezObject("Triangle", pos, ZERO_VECTOR, rot, 0);8485 // set size and shear value86 list send = [size, shear ] ;87 llSay(-42, llList2CSV(send));88 }8991 {93 return r / l * v;94 }9597 {98 integer i;99 integer segments = subdivision + 1;100 vector dx = (bottomRight - bottomLeft) / segments;101 vector dy = (top - bottomLeft) / segments;102 for (i = 0; i < segments; i++) {103 integer j;104 for (j = 0; j < subdivision * 2 + 1 - 2 * i; j++) {105 if((j % 2) == 0) {106 // even, draw left and bottom line107 integer l = j / 2;108 vector v1 = scaleToSphere(bottomLeft + l * dx + i * dy);109 vector v2 = scaleToSphere(bottomLeft + l * dx + (i+1) * dy);110 vector v3 = scaleToSphere(bottomLeft + (l+1) * dx + i * dy);111 drawLine(v1, v2);112 drawLine(v1, v3);113 drawTriangle(v1, v2, v3);114 } else {115 // odd, draw right line116 integer l = (j - 1) / 2;117 vector v1 = scaleToSphere(bottomLeft + l * dx + (i+1) * dy);118 vector v2 = scaleToSphere(bottomLeft + (l+1) * dx + i * dy);119 vector v3 = scaleToSphere(bottomLeft + (l+1) * dx + (i+1) * dy);120 drawLine(v1, v2);121 drawTriangle(v1, v2, v3);122 }123 }124 }125 }126127 drawDome()128 {129 float l2 = length / 2.0;130 vector bottomLeft = <-l2, -l2, 0.0>;131 vector topLeft = <-l2, l2, 0.0>;132 vector topRight = <l2, l2, 0.0>;133 vector bottomRight = <l2, -l2, 0.0>;135 r = llVecMag(bottomLeft - topRight) / 2.0;136 drawSide(bottomLeft, top, bottomRight);137 drawSide(topLeft, top, bottomLeft);138 drawSide(topRight, top, topLeft);139 drawSide(bottomRight, top, topRight);140 }141142 initialize()143 {144 llSetSitText("Build");145 llSetText("Right click and 'Build'", <1, 0, 0>, 1.0);146 llSitTarget(<0.5, 0.0, 0.7>, ZERO_ROTATION);147 base = llGetPos();148 }149150 default151 {152 touch_start(integer total_number)153 {154 llSay(0, "Right click me and choose 'Build' to start build");155 }156158 {159 initialize();160 }161162 state_entry()163 {164 initialize();165 }166168 {169 // sitdown or standup170 if(change & CHANGED_LINK) {171 key av = llAvatarOnSitTarget();172 if(av) {173 // sitdown174 initialize();175 drawDome();176 base.z += length + 1.0;177 move(base);178 }179 }180 }181 }
Category: Building
By : Shine Renoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life
123 // One time scale script4 // 2007 Copyright by Shine Renoir (fb@frank-buss.de)5 // Use it for whatever you want, but keep this copyright notice6 // and credit my name in notecards etc., if you use it in7 // closed source objects89 integer handle;1011 default12 {13 state_entry()14 {16 }1719 {20 llSetScale((vector) message);21 llListenRemove(handle);22 }2325 llResetScript();26 }27 }
Category: Building
By : Shine Renoir
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life
12 // One time scale and shear script3 // 2007 Copyright by Shine Renoir (fb@frank-buss.de)4 // Use it for whatever you want, but keep this copyright notice5 // and credit my name in notecards etc., if you use it in6 // closed source objects78 integer handle;910 default11 {12 state_entry()13 {15 }1618 {19 list tokens = llCSV2List(message);22 llSetPrimitiveParams([24 0, // hollow shape25 <0.0, 1.0, 0.0>, // cut26 0.0, // hollow27 <0.0, 0.0, 0.0>, // twist28 <0.0, 1.0, 0.0>, // taper29 <shear, 0.0, 0.0>, // top shear30 PRIM_SIZE, size31 ]);32 llListenRemove(handle);33 }3436 llResetScript();37 }38 }
Back to the Best Free Tools in Second Life and OpenSim.