这是我用来在我的《刑法》中增加两条:
- (void)addBoxBodyForSprite:(CCSprite *)sprite {
b2BodyDef spriteBodyDef;
spriteBodyDef.type = b2_dynamicBody;
spriteBodyDef.position.Set(sprite.position.x/CTM_RATIO, sprite.position.y/CTM_RATIO);
spriteBodyDef.userData = sprite;
b2Body *spriteBody = world->CreateBody(&spriteBodyDef);
b2PolygonShape spriteShape;
spriteShape.SetAsBox(sprite.contentSize.width/CTM_RATIO/2, sprite.contentSize.height/CTM_RATIO/2);
b2FixtureDef spriteShapeDef;
spriteShapeDef.shape = &spriteShape;
spriteBody->CreateFixture(&spriteShapeDef);
}
而不是PTM_Ratio 我选择了CTM_Ratio。 不管怎么说,我的博览会都没有在我的会堂上得到适当的定位。
因此,我要解释一下我的问题,我说我的间谍活动是50个 p,有100个els。 看来,像我的b2Body一样,在这种间谍活动中,多达60个食堂,有110个食堂。
I know Box2D uses meters but is there any way to PERFECTLY but the b2Body onto my CCSprite maybe by using Pixels?
感谢!