i know from
https://processing.org/reference/shape_.html
shape(s)
shape(s, x, y)
shape(s, a, b, c, d)
and
s.translate(x, y)
also it is possible to use in P3D
s.translate(x, y, z)
what is additive,
so
s.resetMatrix();
s.translate(sx,sy,sz);
shape(s);
same as
translate(sx,sy,sz);
shape(s);
my question is, why there is no 3D position ( or i miss something )
shape(s,sx,sy,sz);
playcode
PShape s;
float sx=0,sy=0,sz=-1000,sang=0, speed = 1;
void setup() {
size(400, 400, P3D);
s = createShape(BOX,10,30,80);
s.setFill(color(0,0,0));
s.setStroke(color(200,0,0));
s.setStrokeWeight(0.5);
}
void draw() {
background(0, 0, 80);
move_s();
}
void move_s(){
sx += speed; if ( sx > width ) sx = 0;
sy += speed; if ( sy > height) sy = 0;
sz += 5*speed; if ( sz > 300 ) {sx=0; sy=0; sz = -1000;}
sang +=0.02;
println(sx, sy, sz, nf(sang,0,1));
s.resetMatrix();
s.rotateX(sang);
s.rotateY(sang);
s.translate(sx,sy,sz);
//translate(sx,sy,sz);
shape(s);
}