0
我正在使用下面的代碼嘗試生成多邊形形狀精靈。我遇到了代碼問題,任何人都可以發現它有什麼問題嗎?XCode多邊形精靈問題
b2BodyDef woodBodyDef;
woodBodyDef.position.Set(400/PTM_RATIO,100/PTM_RATIO);
woodBodyDef.type = b2_dynamicBody;
woodBodyDef.userData = _wood;
_body = _world->CreateBody(&woodBodyDef);
b2PolygonShape woodShape;
int num = 4;
b2Vec2 vertices[] = {
b2Vec2(-137.0f/PTM_RATIO,-32.5f/PTM_RATIO),
b2Vec2(-137.0f /PTM_RATIO,36.5f/PTM_RATIO),
b2Vec2(137.0f /PTM_RATIO,36.5f/PTM_RATIO),
b2Vec2(136.0f /PTM_RATIO, -32.5f/PTM_RATIO)
};
woodShape.Set(vertices, num);
b2FixtureDef woodShapeDef;
woodShapeDef.shape = &woodShape;
woodShapeDef.density = 1.0f;
woodShapeDef.friction = 1.0f;
woodShapeDef.restitution = 0.5f;
woodBodyDef.userData = _wood;
_body = _world->CreateBody(&woodBodyDef);
你可以分享發生的錯誤(如果有的話),或者當它運行時會發生什麼?它什麼都不做?有什麼東西出現,這是不希望的?你能否提供一些關於這件事發生的更多信息。 – Walls
http://www.facebook.com/photo.php?fbid=608369395847146&set=a.198688853481871.58423.100000222736877&type=1&theater this problem pic當我運行 –
@AlexSmith這是box2d的代碼,而不是他的。另外它說b2Assert(area> b2_epsilon); – Sebastian