The number of PTM_RATIO definitions when box2d is used in the cocos2d-x is related to the features of box2d itself. Someone else has explained it very clearly: www. raywenderlich. The following is an excerpt from the key part of the com28602intro-to-box2d-with-cocos2d-2-x-tutorial-bouncing-balls: # definePTM_RATIO32.0Thisis
The number of PTM_RATIO definitions when box2d is used in the cocos2d-x is related to the features of box2d itself. Someone else has explained it clearly: the http://www.raywenderlich.com/28602/intro-to-box2d-with-cocos2d-2-x-tutorial-bouncing-balls below is an excerpt from the key part: # define PTM_RATIO 32.0 This is
The number of PTM_RATIO definitions when box2d is used in the cocos2d-x is related to the features of box2d itself. What others have explained is clear:
Http://www.raywenderlich.com/28602/intro-to-box2d-with-cocos2d-2-x-tutorial-bouncing-balls
The following is an excerpt from the key part:
This is defining a ratio of pixels to "meters ". when you specify where bodies are in Cocos2D, you give it a set of units. although you may consider using pixels, that wocould be a mistake. according to the Box2D manual, Box2D has been optimized to deal with units as small as 0.1 and as big as 10. so as far as length goes people generally tend to treat it as "meters" so 0.1 wocould be about teacup size and 10 wocould be about box size.
So we don't want to pass pixels in, because even small objects wocould be 60 × 60 pixels, way bigger than the values Box2D has been optimized. so we need to have a way to convert pixels to "meters", hence we can just define a ratio like the above. so if we had a 64 pixel object, we cocould pide it by PTM_RATIO to get 2 "meters" that Box2D can deal with for physics simulation purposes.