0

我用这两个身体连接。球员身体和他的脚身。但是脚身不跟随球员身体。?

  final FixtureDef fixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0.1f);
    this.body = PhysicsFactory.createBoxBody(this.mPhysicsWorld, this, BodyType.DynamicBody, fixtureDef);
    this.body.setUserData("player");
    this.body.setFixedRotation(true);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(this, this.body, true, true));
    this.setCurrentTileIndex(8); //Başlangıç resmi

    this.foot = new Rectangle(this.getX()-20, this.getY(), 10, 50);

    final FixtureDef footFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0, true);
    footFixtureDef.isSensor = true;
    this.footBody=PhysicsFactory.createBoxBody(this.mPhysicsWorld, this.foot, BodyType.DynamicBody, footFixtureDef);
    this.footBody.setUserData("foot");
    this.foot.setColor(0.9f, 0.3f, 0.6f);

    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(this.foot, this.footBody, true, true));

     final WeldJointDef joint = new WeldJointDef();
     joint.initialize(this.body, this.footBody, this.body.getWorldCenter());
     this.mPhysicsWorld.createJoint(joint);
4

1 回答 1

1

10 分钟内你有 10 个问题,每个问题都是 - 两个单词和一大段没有明确定义的代码。如果您不修改问题,没有人会回答您。

于 2013-10-23T17:03:27.053 回答