YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← Build a Stairway - Interactive 3D Graphics

Get Embed Code
2 Languages

Showing Revision 2 created 05/25/2016 by Udacity Robot.

  1. Congratulations, I'm guessing this problem took you a bit to figure out. My
  2. teaching assistant Congard de Kana came up with this problem so it was fun for
  3. me to solve in my own way. The key insight for me was that each step needed to
  4. be a constant distance up and forward from the previous step. From the second
  5. step I started by adding the height of the first step to its location. This
  6. first step's height is the vertical step's pieces height plus the step's
  7. thickness. The other piece of the puzzle is how far forward the second step is
  8. from the first. From the diagram we see that this is the horizontal step depth
  9. minus the step thickness. With these two values in hand I could create a loop to
  10. generate all of the steps. Here's my code. At the top I computed the height and
  11. depth I needed to offset between each step. Through experimentation I found I
  12. needed to make six steps with my loop. On each loop iteration I modified both
  13. the vertical and horizontal parts of the step by adding in the height and depth
  14. offsets.