Box 2d basic questions

Posted by philipp on Game Development See other posts from Game Development or by philipp
Published on 2012-04-01T08:31:22Z Indexed on 2012/04/01 17:44 UTC
Read the original article Hit count: 834

Filed under:
|

I am a bit new to box2d and I am developing an game with type and letters. I am using an svg font and generate the box2d bodies direct from the glyphs path definition, using the convex hull of them. I also have an decomposition routine the decomposes this hull if necessary. All this it is more or less working, except that I got some strange errors which definitely are caused by the scale factors. The problem is caused by two factors:

first: the world scale of box2d, second: the the precision of curve-approximation of the glyph vectors.

So through scaling down the input vertices for box2d, it happens that they become equal caused by numerical precision, what causes errors in box2d. Through scaling the my glyphs a bit up, this goes away. I also goes away if I chose a different world scale factor, but this slows down the whole animation quite much!

So if my view port is about 990px * 600px and i want to animate Glyphs in box2d which should have a size from about 50px * 50px up to 300px * 300px, which scale factor of the b2world should i choose? How small should the smallest distance from on vertex to another be, while approximating the glyph vectors?

Thanks for help greetings philipp

EDIT::

I continued reading the docs of box2d and after rethinking of the units system, which is designed to handle object from 0.1 up to 10 meters, I calculated a scale factor of 75. So Objects 600px width will are 8 meters wide in box2d and even small objects of about 20px width will become 0.26 meters width in box2d.

I will go on trying with this values, but if there is somebody out there who could give me a clever advice i would be happy!

© Game Development or respective owner

Related posts about box2d

Related posts about fonts