Xcode Box2D CircleShape宣言

时间:2013-07-05 17:14:26

标签: xcode box2d

我对Box2D物理引擎有些新意。我能够将动态和静态的盒子放入我的世界,但是当我试图将圆圈放入我的世界时,它永远不会出现在世界上。我从几个教程中复制了代码,但似乎都没有。有人能告诉我我做错了吗?

//the world is declared in previous code, it is working properly.        
    b2BodyDef newBodyDef;
    newBodyDef.type = b2_dynamicBody;
    newBodyDef.position.Set(0,20);

    //Create the circle shape.
    b2CircleShape circleShape;
    circleShape.m_p.Set(0, 0);
    circleShape.m_radius = 5.0f;

    b2FixtureDef circleFixtureDef;
    circleFixtureDef.shape = &circleShape;
    circleFixtureDef.density = 1;

    m_world->CreateBody(&newBodyDef)->CreateFixture(&circleFixtureDef);

0 个答案:

没有答案