gpt4 book ai didi

android - 关节体不跟随真实的 body

转载 作者:行者123 更新时间:2023-11-29 03:33:00 25 4
gpt4 key购买 nike

我用这两个 body 连接起来。 Player body 和他的 foot body。但是 footBody 不跟随 player body。?

  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);

最佳答案

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

关于android - 关节体不跟随真实的 body ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19528322/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com