# Shape parameter for 3D position

**URL:** <https://discourse.processing.org/t/shape-parameter-for-3d-position/13352>\
**Category:** Coding Questions\
**Created:** [August 13, 2019, 9:25am UTC](https://discourse.processing.org/t/shape-parameter-for-3d-position/13352 "2019-08-13T09:25:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [August 13, 2019, 9:25am UTC](https://discourse.processing.org/t/shape-parameter-for-3d-position/13352/1 "2019-08-13T09:25:33Z")

</div>

i know from  
[https://processing.org/reference/shape\_.html](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

```auto
  s.resetMatrix();
  s.translate(sx,sy,sz);
  shape(s);

```

same as

```auto
  translate(sx,sy,sz);
  shape(s);

```

my question is, why there is no 3D position ( or i miss something )

```auto
  shape(s,sx,sy,sz);

```

> **playcode**
>
> ```auto
> 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);
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 14, 2019, 1:20am UTC](https://discourse.processing.org/t/shape-parameter-for-3d-position/13352/2 "2019-08-14T01:20:22Z")

</div>

You can see the existing shape methods here:

> <https://github.com/processing/processing/blob/processing-0269-3.5.3/core/src/processing/core/PGraphics.java>

There is a:

```auto
  // 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:

```auto
  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.

🙂

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [August 14, 2019, 1:24am UTC](https://discourse.processing.org/t/shape-parameter-for-3d-position/13352/3 "2019-08-14T01:24:01Z")

</div>

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