-2

如何在 Box2d 中创建滑块平台?我可以像音量控制器一样左右移动的平台。

4

1 回答 1

0
    b2PrismaticJointDef jointDef;
    jointDef.Initialize(fixture->GetBody(), groundBody, fixture->GetBody()->GetWorldCenter(), b2Vec2(0.5f,0.0f));
    jointDef.maxMotorForce = 500.0;
    jointDef.enableMotor = true;
    jointDef.lowerTranslation = -2.5f;
    jointDef.upperTranslation =  2.5f;
    jointDef.enableLimit = true;
于 2013-03-15T14:17:03.490 回答