Thank you @Chrisir
My new code like that newbie
import peasy.*;
PeasyCam camera;
ArrayList<Objects> objects = new ArrayList<Objects>();
Guy guy;
PShape head, body, arm, leg;
void setup()
{
guy=new Guy();
size (700, 700, P3D);
camera = new PeasyCam(this, 700);
// frame.setLocation(0,0);
// PShape head -- centered
head = createShape(SPHERE, 20);
head.setStroke(color(255));
head.setStrokeWeight(4);
head.setFill(color(126));
// body -- above and below the center
body = createShape(LINE, 0, -50, 0, 0, 50, 0);
body.setStroke(color(255, 0, 0));
body.setStrokeWeight(4);
body.setFill(color(126));
// arm -- extends down from the center
arm = createShape(LINE, 0, 0, 0, 0, 50, 0);
arm.setStroke(color(189, 0, 0));
arm.setStrokeWeight(4);
arm.setFill(color(126));
// leg -- extends down from the center
leg = createShape(LINE, 0, 0, 0, 0, 75, 0);
leg.setStroke(color(189, 0, 0));
leg.setStrokeWeight(4);
leg.setFill(color(126));
//FOR TABLE---------
// 4 legs
objects.add(new Objects(50-100, 102, -200, 10, 100, 10));
objects.add(new Objects(50+100, 102, -200, 10, 100, 10));
objects.add(new Objects(50-100, 102, -200+100, 10, 100, 10));
objects.add(new Objects(50+100, 102, -200+100, 10, 100, 10));
// and the table itself
objects.add(new Objects(50, 50, -200+50,
240, 10, 140 ));
}
void draw() {
background(51);
guy.show();
guy.show();
//Show table:
for (Objects o : objects)
o.show();
}
//class
class Objects {
PVector pos, bsize;
Objects(int x, int y, int z,
int b, int h, int t) {
pos = new PVector(x, y, z);
bsize = new PVector(b, h, t);
}
void show() {
pushMatrix();
translate(pos.x, pos.y, pos.z);
box(bsize.x, bsize.y, bsize.z);
popMatrix();
}
}
class Guy{
void show(){
// body
shape(body);
// head
pushMatrix();
translate(0, -50, 0);
shape(head);
popMatrix();
// arms
pushMatrix();
translate(0, -15, 0); // move arms from center up to shoulders
pushMatrix();
rotateZ(radians(55)); // swing left arm out
shape(arm);
popMatrix();
pushMatrix();
rotateZ(radians(-55)); // swing right arm out
shape(arm);
popMatrix();
popMatrix();
// legs
pushMatrix();
translate(0, 50, 0); // move legs down to bottom of body
pushMatrix();
rotateZ(radians(25)); // swing left leg out
shape(leg);
popMatrix();
pushMatrix();
rotateZ(radians(-25)); // swing right leg out
shape(leg);
popMatrix();
popMatrix();
}
}
Am I in right place? I will set location for stickman. I need mug on table