b2DebugDraw

Sprite *debugSprite  = new Sprite();
this->addChild(debugSprite);
b2DebugDraw *debugDraw = new b2DebugDraw();
debugDraw->SetSprite(debugSprite);
debugDraw->SetLineThickness(2);
debugDraw->SetAlpha(0.5);
debugDraw->SetFillAlpha(0.8);
debugDraw->SetFlags(b2DebugDraw.e_shapeBit |b2DebugDraw.e_jointBit);
debugDraw->SetDrawScale(PIXEL_TO_METER);
world->SetDebugDraw(debugDraw);

world->Step();
world->ClearForces();
world->DrawDebugData();

发表评论

电子邮件地址不会被公开。 必填项已用*标注