Wednesday, February 4, 2009

Second Life Tetrahedron maker


Finally debugged the LSL script to generate tetrahedrons of any size using equilateral triangular panels of edge size 10m. In the picture you can see my avatar inside a tetrahedron of size 2 next to one of size 3 and I'm inside a massive tetrahedron of size 7 in the shot below.

The last formula to work out (which I'd fudged a number for before) was the distance between the avatar (or generating object) and the centre of the tetrahedron side. This is actually N*10m/sqrt(24) where N is the size of tetrahedron.

It took a little while to get the side on the bottom to detect itself and texture itself with grass rather than being glass when rezzed. My problem was that llVecDist() which I was using to compare the rotation of a panel to the vector rotation I was looking for (<pi,0,0> or <3*pi/2,0,pi>) was ignoring the fact these are angles and so I had to get the sign right (so the last vector had -pi in the z-axis rather than pi).

All those glass panels make for a classy looking instant space station at 4,000m.

Now I have the subroutines to create equilateral platforms of any size I might try a future experiment using them to make something like a truncated cubic honeycomb.

Now to do some proper work!

No comments: