LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

3d Prisms

Root / Programming Questions / [.]

Tiger2Created:
I'm having trouble creating 3d prisms that move and re-angle according to the camera angle. I know to use the For loop so I can create multiple lines with GLINE to make a flat surface, but I'm having trouble figuring out what math to use to make the vertices meet when they should, and the the shapes to distort properly so it looks like it is spinning. For those who know how to do it, is it something you just had learned in school and remembered, or did you have to relearn it when the time came to make such a program? Please help if you can.

Things to look up would be 3D perspective projection and trigonometry in general. Doing basic flat-poly shapes is about the best SB will get you and anything beyond that is substantially more complicated anyway. Projection will help you take the 3D points and put them into the 2D screen and trig will help you to understand a lot of the math involved, particularly rotations. I've forgotten a lot of the formulas involved though. When in doubt, divide by Z.

To be clear, you are talking about a 3d wireframe extruded triangle right? Any reason you haven't looked at SIM.3D (HEAEP3) or Poly3D (4KE3N396)? You do get some concepts in High School Geometry and Trigonometry, but you are not going to get the whole picture without some college level Math and Computer Science courses/self study. So don't feel bad if it is a struggle, that is completely normal. Javidx9 made a 3d engine in a video series on YouTube, if you want to see building one in action.

Thank you!