我用这两个身体连接。球员身体和他的脚体。但是脚身体不跟随球员身体。?
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);
答案 0 :(得分:1)
你有10个问题10分钟,每个问题都是 - 两个单词和一大块代码,没有明确的定义。如果你不修改问题,没有人会回答你。