LibGDX revolute joint make angle difference between body and joint


LibGDX revolute joint make angle difference between body and joint



I been creating tank game that has tank body and tube in separate body and connected together with revolute joint, but this make an angle difference between them



Screenshot of problem



There is revolute joint:


RevoluteJointDef jointDef = new RevoluteJointDef();
jointDef.bodyA = tankBody;
jointDef.bodyB = tankPipeBody;
jointDef.localAnchorA.set(tankBody.getLocalCenter().add(0, 1.6f));
jointDef.localAnchorB.set(tankTubeBody.getLocalCenter().add(3.2f, 0));
jointDef.collideConnected = false;
jointDef.enableMotor = false;
jointDef.referenceAngle = 0;
jointDef.enableLimit = true;
jointDef.lowerAngle = (isLeftPlayer ? -180 : 0) * MathUtils.degRad;
jointDef.upperAngle = (isLeftPlayer ? -180 : 0) * MathUtils.degRad;



But when I was shooting from tube position, bomb body appear from end of green line (joint line)









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

Moria Casán

How to make file upload 'Required' in Contact Form 7?