I have a 3d box bouncing sim, with a camera around the mouse. anyways i want to make the walls different colors so u can tell its 3d, heres my code.
float x;
float y;
int xa;
int xb;
int xdirection = 1;
int ydirection = 1;
int textsize;
float rad=50;
PImage img;
float rotate;
int z;
int d;
int rect;
void setup() {
rad=rad-0.5;
x=random(-12, 12);
y=random(-12, 12);
size(700, 600, P3D);
xa=500;
frameRate (60);
fill(255,0,0);
}
void draw() {
fill(255,0,0);
rect(-700,-600.0,700.0,600.0);
camera(mouseX, mouseY, 700, 200, 300, 350,
-1, -1, -1);
x=x+xdirection;
y=y+ydirection;
if (x> width-rad) {
xdirection=xdirection+-1;
}
if (y>height-rad) {
ydirection=ydirection±1;
}
if (y < 0) {
ydirection=ydirection+1;
}
if (x < 0) {
xdirection=xdirection+1;
}
background(200);
rotateX(PI/5);
fill(0, 0, 255);
translate(x, y, z);
sphere(50);
rotate=rotate +1;
}