## 3D Tetrahedron Wireframe

remixed by boaz4
Notes and Credits (added by boaz4)

7th top loved 8/9/2012!
Curated!

My second wireframe project.
Took a lot of work to calculate the vertices this time.

Please press love-it and comment if you want a tutorial for how to make this!

UPDATE: Okay everybody! You wanted a tutorial, here it is:

The basic idea that I used is that where you rotate the object left and right, every point rotates around the y axis.
When you rotate the object up and down, every point rotates around the x axis.

What I did:

1) I made a sprite for each one of the vertices. Each one had a local variable x, y, z, RoD, and RoDir and was set to the starting value that I wanted.

2) Using simple acceleration scripts I calculated what is the speed each point will rotate up/down and left/right (you can find tutorials for this in lots of platformer tutorials).

3) I am not going to explain all of the math here, because it's a bit complicated. If you want to understand all of the math completely go to hardmath123's tutorial at http://wiki.scratch.mit.edu/wiki/3D_Wireframes . To calculate the new x, y, and z points for each of the vertices, I took a script kind of like:

(credit to SSBBM and Kileymeister for the picture in the block library) where RoX=0 and RoY=0. I copied the script twice. Once I changed every x with z, and once every y with z. That way instead of rotating around the z axis, it rotates around the x and y axis (I changed RoA to xspeed and yspeed when needed of course).

4) Then I made each of the vertices go to the x and y position according to the variables. That would give orthographic projection (objects don't get smaller as they get farther away). Go to

http://en.wikipedia.org/wiki/3D_projection
if you want more information on orthographic vs. perspective projection or want to do some perspective projection yourself.

5) I had one sprite with it's pen down draw the path from one point to another.