I still don't see how pixels/meters with SetAsBox work

Hi, I guess I have a small problem in logical thinking:
1, The manual states that I should try to multiply every pixel coordinate with 0.01f. 100 pixels would therefore amount to 1 Meter, this means that if I have a box of 50 pixels, I can still use 0.01f as scaling factor right?
2, PolygonDef::SetAsBox in the API reads: Build vertices to represent an axis-aligned box. But which corner of the box will the given coordinates represent?

My problem is essentially that I have various different types of box definitions, (OpenGL: you translate a polygon by its middle point, how does it work with Box2D?)
and I don't get how to calculate/position the Box2D boxes so that they correlate with my actual representations.
- Your scale factor must be constant. Also, you must not randomly flip its sign. 🙂
- The origin of a box is the center. Same as circles.

Does OpenGL compute the midpoint of polygon's for you? Is it the centroid? In Box2D the origin of a polygon is defined by you implicitly. If you attach a polygon to a body, the polygon's origin coincides with the body's origin (not the center of mass).
Thanks, I rewrote the code. The box now bounces straight up with extreme speed...but at least it bounces. Changing gravity or density does not improve on it, why would it bounce into infinite +y space?

Another question: What if my box is not controllable anymore when on ground? Do my objects have to be sleeping (=no physics calculations) to be controllable?
I don't know why the box is moving up so fast. Are you setting the restitution values or using the defaults?

TheDemocrat wrote:
Another question: What if my box is not controllable anymore when on ground? Do my objects have to be sleeping (=no physics calculations) to be controllable?


Sorry, I do not understand your question. What do you mean by controllable?

Are you using this definition? http://en.wikipedia.org/wiki/Controllability
edited: I finally get what the manual meant with "scaling system": Scale down the graphics and at the same time zoom in with the camera. 🙄

Original thread: https://box2d.org/forum/viewtopic.php?t=3384