# Lesson goal: Draw with cubes

Previous: 3D graphics and the light source | Home | Next: Drawing lines in 3D

In a previous lesson, you did some drawing with spheres. You can also draw here with cubes (sort of like Minecraft...we guess).

Also, remember, you are coding now. You can use for-loops and such to draw lots of cubes; they don't have to be placed one at a time. See example #4.

cube(x,y,z,width,height,depth,"color")

You can find a list of color codes here. The 3D drawing area will appear under your code-editor. You might have to scroll down to see it.

# Now you try. Fill in a x,y,z and width, length, and height of your cube.

This code will not run!

• Fill in $(x,y,z)$ coordinates of the cube, then a width, length, and height. To start out, keep all numbers between 0 and 10 or so.

• Also, your cube might just look like a square (as you are looking at it head-on). To see the cube, you'll have to move the camera and/or light source around a little bit.
Dismiss.
Show a friend, family member, or teacher what you've done!