2
我是Box2d的新手,有两种机构。一个是静态的,另一个是动态的。我希望我的动态身体向下走,并且沿着同一条线回到另一个身体。经过一些初步研究后,我想使用棱镜联合。我已经看过一些例子,并在onLoadScene()中编写了一段代码。但没有任何动作。这里是代码:如何在Box2d中使用棱镜接头for android
@Override
public Scene onLoadScene()
{
.....
PrismaticJointDef prismaticJointDef = new PrismaticJointDef();
prismaticJointDef.initialize(bdy_holder, bdy_spring, bdy_holder.getWorldCenter(), new Vector2(1.0f, 0.0f));
prismaticJointDef.lowerTranslation = -5.0f;
prismaticJointDef.upperTranslation = 2.5f;
prismaticJointDef.enableLimit = true;
prismaticJointDef.maxMotorForce = 200.0f;
prismaticJointDef.motorSpeed = 10.0f;
prismaticJointDef.enableMotor = true;
prismaticJointDef.collideConnected = true;
prismatic_Joint = (PrismaticJoint)this.mPhysicsWorld.createJoint(prismaticJointDef);
}
现在我认为当我运行应用程序时,身体应该移动,但他们不是movng。我是全新的,无法弄清确切的问题。请引导我解决这个问题,解决方案和正确的例子。谢谢。