Libgdx 模拟弹丸运动时,如何处理旋转关节?

Libgdx 模拟弹丸运动时,如何处理旋转关节?,libgdx,box2d,Libgdx,Box2d,我有一些问题,我已经设置了启动箭头体的测试代码,所以我通过旋转关节将箭头体连接到圆体上。我已经建立了一些基本的测试代码来启动箭体,但问题是,箭体卡在旋转关节上,箭体无法脱离这个关节。我想知道解决这个问题的办法是什么 我用一个按钮来启动箭头,当按下按钮时箭头移动。为了解决上述问题,我试着破坏旋转体,但这不是移动箭头的好方法 有什么建议吗 这是密码 revoluteJoint = new RevoluteJointDef(); revoluteJoint.bodyA = rotatorBod

我有一些问题,我已经设置了启动箭头体的测试代码,所以我通过旋转关节将箭头体连接到圆体上。我已经建立了一些基本的测试代码来启动箭体,但问题是,箭体卡在旋转关节上,箭体无法脱离这个关节。我想知道解决这个问题的办法是什么

我用一个按钮来启动箭头,当按下按钮时箭头移动。为了解决上述问题,我试着破坏旋转体,但这不是移动箭头的好方法

有什么建议吗

这是密码

revoluteJoint = new RevoluteJointDef();
    revoluteJoint.bodyA = rotatorBody;                          //defining the first body for the revolute joint 
    revoluteJoint.bodyB = arrowBody;                            //defining the second body for the revolute joint
    revoluteJoint.localAnchorB.set(0,0);                        //defining where you want the anchor point to be on the arrowbody
    revoluteJoint.collideConnected = false;                     //this is so that the relevant bodies can overlap
    revoluteJoint.enableMotor = true;                           //letting the joint move by itself
    revoluteJoint.maxMotorTorque = 250.0f;                      //maximum force
    revoluteJoint.motorSpeed = 0.0f;                            //speed is set to 0 so that the user can only move the arrow with touch
    world.createJoint(revoluteJoint);

buttonSTART.addListener(new InputListener(){
     @Override
     public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
             //game.setScreen(new Screenconfirmation(game));
        world.destroyBody(rotatorBody);
        arrowBody.setAwake(true);
        arrowBody.setGravityScale(1.0f);
        arrowBody.setAngularVelocity(0.0f);
        arrowBody.setTransform(arrowBody.getWorldPoint(new Vector2(3,0)), arrowBody.getAngle());
        arrowBody.setLinearVelocity(new Vector2(150,0));
             return true;
     }

}))

添加这一行world.createBody(rotatorBodyDef);在世界毁灭之后,天体似乎阻止了日食的崩溃