I can easily get the position of the body but assuming it is a box, how do I determine the coordinates of the box so I can display it?
Just to get it to display, I hard-coded it to a 10 x 10 but if I'm drawing a wall, it should be tall while a moving platform should be much smaller and wider.
public void draw() {
if (bodySocket.isConnected()) {
world = JSONObject.parse(getWorld());
} else { System.exit(1); }
background(100);
Iterator<?> keys = world.keyIterator();
String key;
JSONObject body;
while (keys.hasNext()) {
key = (String)keys.next();
body = world.getJSONObject(key);
rectMode(PApplet.RADIUS);
fill(255, 100);
rect(body.getFloat("x"), fieldBottom - body.getFloat("y"), 10, 10);
}
}