3d movement
in
Programming Questions
•
2 years ago
i was wondering how i can make the sphere movee backwards and forwards , left and right and up and down.
thecode:
//import processing.opengl.*;// BY IMPORTING THE GRAQPHIC CARD IS ENABLED.
float inc = 6;
boolean LEFT ;
boolean RIGHT;
boolean UP;
boolean DOWN;
void setup () {
noFill();
size(600, 600, OPENGL);// OPENGL ALLOWS THE USER TO ACCES THE GRAPHICS CARD.
frameRate(12);
noLoop();
}
void draw() {
background(123, 0, 5);
//lights();// adds a flourescent light and shadows kabanga
inc = 0.5 ;
pushMatrix();
translate(width/2,height/2);// allows the image to be at the centre of the page//by adding mouse function i will be allowed to move the sqaure
//rotateX(mouseX); //this will rotate the x axis
//rotateY(mouseY);//this will rotate the y axis
//rotateZ(inc);
//allows the object to rotate groovy alothough a z rotate is not needed.
box(400,400,400);
box(inc++);
smooth();
popMatrix();
}
1