We are about to switch to a new forum software. Until then we have removed the registration on this forum.
PImage myImage;
float x,y,z;
int rotatex, ry, rz = 0;
float newt;
void setup() { // this is run once.
// set the background color
background(255, 255, 255);
// canvas size (Integers only, please.)
size(800, 600, P3D);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(50);
// set the width of the line.
strokeWeight(1);
x = width/2;
y = height/2;
z = 0;
}
void draw() { // this is run repeatedly.
translate(x, y, z);
rotateZ(rz);
rotateY(ry);
rotateX(newt);
fill(0, 0, 255);
box(50, 100, 50);
}
This code right here makes a 3D box that I can edit but it keep making the same box over and over again, how can i make one box and keep it there without it making another box? I tried putting it on setup but it didnt work.
Answers
I dont know how to post code
https://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
i have fixed the formatting.
i can't see the problem with that code. i see one box which doesn't move.
set the background color at beginning of draw() to delete
also angles need to be float (it's radians with rotate, not degrees)
when you want to use an angle from 0 to 360 (in degrees) that's fine
but then you need to say rotate(radians(angle));
so you convert the value in degrees to a value in radians (0 to 2 times
PI
)