Stupid question about joints and anchors

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

I still can't get that working so I'm shifting to direct odejava use (through jme or xith) … however if someone can give some help I'd like to compare the 2 versions

People can't tell what you do wrong, when you don't say what you consider to be 'right' ;)  (haven't run your code)

If you describe in more detail, what is wrong and how you expect it different and maybe supply a stripped down sample (with only two object and one joint, for example) someone might be able to tell what's wrong.



Doing it with odejava directly should be quite the same, if not more, complicated.

here is a simpler example:


 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 armBase2= getPhysicsSpace().createDynamicNode();
        rootNode.attachChild( armBase2 );
        armBase2.createBox( "armbase2" );

        armBase2.getLocalTranslation().set( 1, 2.25f, 0 );
        armBase2.getLocalScale().set( 2, 2, 2 );
        armBase2.computeMass();
       
       
        DynamicPhysicsNode armLimb1= getPhysicsSpace().createDynamicNode();
        rootNode.attachChild( armLimb1);
        armLimb1.createBox( "armJoint1" );
        armLimb1.getLocalScale().set( 3, 1, 1 );

        armLimb1.getLocalTranslation().set( 3.5f, 3.75f, 0 );
        armLimb1.computeMass();
        final Joint jointForLimb1 = getPhysicsSpace().createJoint();
        jointForLimb1.attach(armLimb1,armBase2);
        jointForLimb1.setAnchor(new Vector3f( -1.5f, -0.5f, 0 ));
        JointAxis axis=jointForLimb1.createRotationalAxis();
       
        axis.setDirection(new Vector3f( 0, 0, 1 ));
}
       



What I expected was that the armlimb box rotates around its lower left edge while it falls inside the armbase2 box...
whats the problem?
It looks like the distance between the anchor and the center of armbase2 is not constant.. should not it be fixed after setting the joint?

:// that actually was a bug in the jME Physics ODE binding, sorry. Fixed in CVS.

thanks i was going mad…

and still can't get odejava work alone(its quite old and xith binding too, whilw old jme physics is no more mantained)