## ← Build a Stairway - Interactive 3D Graphics

• 2 Followers
• 14 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=OjKXkg08xrY" data-team="udacity"></div> ``` 3 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.