如何在Box2d中创建Slider平台?我可以像音量控制器一样从一侧移动到另一侧的平台。
答案 0 :(得分: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;