# Standing a Cube on its Corner

**URL:** <https://discourse.processing.org/t/standing-a-cube-on-its-corner/33477>\
**Category:** Project Guidance\
**Created:** [November 12, 2021, 6:14pm UTC](https://discourse.processing.org/t/standing-a-cube-on-its-corner/33477 "2021-11-12T18:14:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingnine](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kingnine](https://discourse.processing.org/u/kingnine)\
**Post date:** [November 12, 2021, 6:14pm UTC](https://discourse.processing.org/t/standing-a-cube-on-its-corner/33477/1 "2021-11-12T18:14:25Z")

</div>

Hi all, I have a question that sounds incredibly simple, but is proving very challenging, and I think it would be educational for me to learn where I’m going wrong.

All I’m trying to do is make a cube and stand it on its corner.

My initial snippet of code looks like this:

```auto
void draw() {
  background(2);
  translate(width/2, height/2);
  pushMatrix();
    rotateX(PI/4);
    rotateY(PI/4);
    box(width/2);
  popMatrix();

```

I soon learned two things that caused my problem: First, the angle to rotate the cube once it’s on its side is not 45 degrees (that is, pi/4 radians). Second, Processing rotates the whole coordinate system, so when you start doing rotations, all the rest of the rotations are relative to all the previous ones! Both of these factors are making it extremely difficult to get the geometry right to stand the cube on its corner.

How can I get the geometry to work?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 13, 2021, 1:14am UTC](https://discourse.processing.org/t/standing-a-cube-on-its-corner/33477/2 "2021-11-13T01:14:53Z")

</div>

Maybe instead of rotateY use rotateZ
