I've a shoulder, armbase2 and a limb armlimb1…
I've used a rotational joint and setted the anchor
but the limb doesn't rotate around the right point…
protected void simpleInitGame() {
pause=true;
showPhysics = true;
StaticPhysicsNode staticNode = getPhysicsSpace().createStaticNode();
rootNode.attachChild( staticNode );
PhysicsBox floorBox = staticNode.createBox( "floor" );
floorBox.getLocalScale().set( 10, 0.5f, 10 );
DynamicPhysicsNode armBase1= getPhysicsSpace().createDynamicNode();
rootNode.attachChild( armBase1 );
armBase1.createBox( "armbase1" );
// but put the sphere a little to the side
armBase1.getLocalTranslation().set( 0, 0.75f, 0 );
armBase1.getLocalScale().set( 4, 1, 4 );
DynamicPhysicsNode armBase2= getPhysicsSpace().createDynamicNode();
rootNode.attachChild( armBase2 );
armBase2.createBox( "armbase2" );
// but put the sphere a little to the side
armBase2.getLocalTranslation().set( 1, 2.25f, 0 );
armBase2.getLocalScale().set( 2, 2, 2 );
final Joint jointForBase = getPhysicsSpace().createJoint();
jointForBase.attach(armBase1,armBase2);
DynamicPhysicsNode armLimb1= getPhysicsSpace().createDynamicNode();
rootNode.attachChild( armLimb1);
armLimb1.createBox( "armJoint1" );
armLimb1.getLocalScale().set( 3, 1, 1 );
// but put the sphere a little to the side
armLimb1.getLocalTranslation().set( 3.5f, 3.75f, 0 );
//armBase1.getLocalScale().set( 4, 1, 4 );
final Joint jointForLimb1 = getPhysicsSpace().createJoint();
jointForLimb1.attach(armLimb1,armBase2);
JointAxis axis=jointForLimb1.createRotationalAxis();
//jointForLimb1.setAnchor(new Vector3f( 1, 1, 0 ));
axis.setDirection( new Vector3f( 0, 0, 1 ) );
//jointForLimb1.setAnchor(new Vector3f( 1, 1, 0 ));
//axis.setRelativeToSecondObject(true);
jointForLimb1.setAnchor(new Vector3f( -1.5f, -0.5f, 0 ));
//jointForLimb1.createRotationalAxis().setDirection( new Vector3f( 0, 0, 1 ) );
What is my mistake?
I can't fiugre it out from examples and tutorilas