Game Development Reference
In-Depth Information
Then we create the debug draw object. This is optional, as I said before. The flags indicate
what you wish to see in the drawing. In the code we saw before, we only want to see the
shapes of the objects.
Then comes PTM_RATIO , the defined constant we passed as a parameter to the debug
draw. Box2D uses meters instead of pixels for a variety of reasons that are really entirely
unnecessary for anyone to know. Except for one reason, pixel to meter ( PTM ), so every
pixel position value used in the game will be divided by this ratio constant. If the result
from this division ever gets above 10 or below 0.1, increase or decrease the value for
PTM_RATIO accordingly.
You have some leeway, of course. By all means, play with this value once your game is
completed, and pay special attention to the subtle differences in speed (another common
value for this ratio is 100).
Search WWH ::




Custom Search