I m在“i”游戏中工作,地面长,重复直径层的物体,该物体在屏幕底线上延伸了约30个。 我试图使我的地面对冲形成30个els子,这样,当参与者从跳跃到地面上的土地时,他就会以地面形象为重。 当我尝试增加以下法典时,它就没有工作:
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(0, 30/PTM_RATIO);
b2Body *groundBody=world->CreateBody(&groundBodyDef);
b2EdgeShape groundLine;
groundLine.Set(b2Vec2(0, 30/PTM_RATIO), b2Vec2(screenSize.width/PTM_RATIO, 30/PTM_RATIO));
groundBody->CreateFixture(&groundLine, 0);
I realize I could probably use a rectangle shape for the ground, but since my player sprite is only colliding with the top of the image, I would rather get away with an edge shape.