# PBox2D How to change individual shapes' Position in a body?

**URL:** <https://discourse.processing.org/t/pbox2d-how-to-change-individual-shapes-position-in-a-body/30646>\
**Category:** Libraries\
**Created:** [June 11, 2021, 8:25am UTC](https://discourse.processing.org/t/pbox2d-how-to-change-individual-shapes-position-in-a-body/30646 "2021-06-11T08:25:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![goblincaptain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/goblincaptain/32/13613_2.png) [@goblincaptain](https://discourse.processing.org/u/goblincaptain)\
**Post date:** [June 11, 2021, 8:25am UTC](https://discourse.processing.org/t/pbox2d-how-to-change-individual-shapes-position-in-a-body/30646/1 "2021-06-11T08:25:16Z")

</div>

I want to create a static body with two rectangles in processing, and i want them to be like an “L”, but now the two rectangles are placed in the middle, and I don’t know how to fix that. Any suggestion will be appreciated!

Here is a screenshot:

 ![截屏2021-06-11 下午4.22.17](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/24a64c80bfa033c8bb4ddd63fb8f5855dd7cd091.png)

void makeBody(Vec2 center) {

```
BodyDef bd = new BodyDef();
bd.type = BodyType.STATIC;
bd.position.set(box2d.coordPixelsToWorld(center));
body = box2d.createBody(bd);

PolygonShape sd = new PolygonShape();
float box2dW = box2d.scalarPixelsToWorld(w/2);
float box2dH = box2d.scalarPixelsToWorld(h/2);
sd.setAsBox(box2dW/2, box2dH);

body.createFixture(sd, 1.0);

PolygonShape sd2 = new PolygonShape();
float box2dW2 = box2d.scalarPixelsToWorld(w/2);
float box2dH2 = box2d.scalarPixelsToWorld(h/2);
sd2.setAsBox(box2dW2, box2dH2/2);

body.createFixture(sd2, 1.0);

```

}  
}

---

<div class="post-metadata">

**Author:** ![goblincaptain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/goblincaptain/32/13613_2.png) [@goblincaptain](https://discourse.processing.org/u/goblincaptain)\
**Post date:** [June 11, 2021, 9:03am UTC](https://discourse.processing.org/t/pbox2d-how-to-change-individual-shapes-position-in-a-body/30646/2 "2021-06-11T09:03:41Z")

</div>

Any suggestion will be appreciated!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 11, 2021, 3:13pm UTC](https://discourse.processing.org/t/pbox2d-how-to-change-individual-shapes-position-in-a-body/30646/3 "2021-06-11T15:13:27Z")

</div>

Dunno much about this library but, have you considered that perhaps its coordinate mode would be CENTER instead of CORNER? 🤔  
[Processing.org/reference/rectMode\_.html](http://Processing.org/reference/rectMode_.html)
