I'm using Box2D in my game and I'm having a little problem.
I know Box2D has some issues with very small objects (I think I read it in the manual). Besides, when the pixel to meter ratio used to render the objects in my "physics world" becomes very large (for example 1000 pixels = 1 meter) then the values I get from the vertex array of Box2D shapes start becoming less and less exact.
For example, at 100 pixels = 1 meter things are rendered ok, collide between them nicely and everything looks good. At 1500 pixels = 1 meter, things start to look weird, The shapes are rendered with some kind of offset (when they collide they don't touch each other visually, but collide a few pixels from being completely next to each other).
I think the problem lies in the default units in Box2D. My game can't use a pixel ratio of 100 because the things I'm trying to model are small objects that are at most 1 centimeter long in the real world. If I make them any longer they fall slowly (they have to travel a big distance in meters to reach a certain point).
If the ratio is bigger, each pixel represents a smaller distance, and traveling 100 pixels in less time would require less speed, hence the objects would fall faster.
What I need to know is if there's a way to use centimeters as the default length value so that I can have a lower pixel ratio (like 100) and still use "more precise" values to render my objects. I tried to look the b2Settings.h file but had no luck figuring out which constants to change.
Thanks in advance.
I know Box2D has some issues with very small objects (I think I read it in the manual). Besides, when the pixel to meter ratio used to render the objects in my "physics world" becomes very large (for example 1000 pixels = 1 meter) then the values I get from the vertex array of Box2D shapes start becoming less and less exact.
For example, at 100 pixels = 1 meter things are rendered ok, collide between them nicely and everything looks good. At 1500 pixels = 1 meter, things start to look weird, The shapes are rendered with some kind of offset (when they collide they don't touch each other visually, but collide a few pixels from being completely next to each other).
I think the problem lies in the default units in Box2D. My game can't use a pixel ratio of 100 because the things I'm trying to model are small objects that are at most 1 centimeter long in the real world. If I make them any longer they fall slowly (they have to travel a big distance in meters to reach a certain point).
If the ratio is bigger, each pixel represents a smaller distance, and traveling 100 pixels in less time would require less speed, hence the objects would fall faster.
What I need to know is if there's a way to use centimeters as the default length value so that I can have a lower pixel ratio (like 100) and still use "more precise" values to render my objects. I tried to look the b2Settings.h file but had no luck figuring out which constants to change.
Thanks in advance.