3d problem with a simple title game

here is a mcve of a 3D grid

The advantage of when you post an mcve:

  • I couldn’t run your code because there was camera stuff in it. With a mcve, there is no camera stuff.
  • A mcve is runnable with copying code from the forum in one go (and I don’t have to copy and paste 3 times from your post, when you posted the code in 3 or 4 sections as you did). No hassle for the helping person.
  • We don’t have to read hundreds of lines of code but see the core problem immediately
  • to get better help it’s easier if you name all functions in English and not in Spanish

Chrisir

float angle;   // for rotation 
float factor1=80.0; // dist between boxes

void setup() {
  size( 800, 800, P3D );

  stroke(111);  // gray 
  fill(255, 2, 2); // red
} // setup

void draw() {
  background(0);
  lights();

  translate(width/2, height/2, 0); 
  rotateY(angle);

  for (int x=0; x<3; x++) {
    for (int y=0; y<3; y++) {
      for (int z=0; z<3; z++) {

        pushMatrix(); 
        translate(x*factor1, 
          y*factor1, 
          z*factor1);
        box(40);  // size of 40 (width, height and depth) 
        popMatrix();
      }
    }
  }

  angle+=.01;
} // draw
1 Like