0

我对 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);
4

0 回答 0