3D problems help
in
Programming Questions
•
2 years ago
please help i am having trouble allowing the sphere to draw a line. and i have read the basics and im still stuck
import processing.opengl.*;
int x, y, z;
int speed = 10;
//PImage etch;
void setup() {
size(700, 630, OPENGL);
}
void draw() {
background(255, 255, 255);
lights();
pushMatrix();
translate(width/2,height/2);
box(450);{ noFill();}
box(450);{ noFill();}
translate(width/12,height/12);
translate(x, y, z);
strokeWeight(2);
stroke(5);
sphere(5);
strokeWeight(2);
stroke(5);
noFill();
smooth();
strokeWeight(10.0);
strokeJoin(MITER);
beginShape();
vertex(35, 20);
vertex(65, 50);
vertex(35, 80);
//endShape();
popMatrix();
}
void keyPressed() {
if (keyCode == UP) { y-=speed; }
if (keyCode == DOWN) { y+=speed; }
if (keyCode == LEFT) { x-=speed; }
if (keyCode == RIGHT) { x+=speed; }
if (keyCode == SHIFT) { z+=speed; }
if (keyCode == CONTROL) { z-=speed; }
}
1