Shape parameter for 3D position

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);
}

1 Like

You can see the existing shape methods here:

There is a:

  // TODO unapproved
  protected void shape(PShape shape, float x, float y, float z) {
    showMissingWarning("shape");
  }

From the examples in the source I made my own:

  shape(s, sx, sy, sz);
  }

 public void shape(PShape shape, float x, float y, float z) 
    {
    if (shape.isVisible())
      {
      flush();
      pushMatrix();
      translate(x, y, z);
      shape(shape);
      popMatrix();
      }
    }

In your example the translate(sx,sy,sz); does the same as the method would.

:slight_smile:

2 Likes

thanks, so it is “in work” already and i not need to open a “issue”.