Attaching two joints on different locations on a object

Is it possible to attach two joints to an object?

For example if i want to attach two joints each at one end of a cylinder.



joint                                joint

    |                                  |

    |                                  |

    =================

              cylinder



Or is a joint always attached to the center of an object?

when you create a joint you can set its Axes, so you can give the two joints different axes like (0,1,0) and (0,-1,0), be carefully that your cylinder is always the first value in joint.attach(node,node).

hmm  but do the joints RotiationlaAxis / TranslationalAxis not only restrict the movement ?

i would kinda like to hang the cylinder onto two ropes, which are attached at each end of the cylinder.



looking at it again i think joint.setAnchor(Vector3f(-1, 0, 0)) is what i want.

This fixes the joint not in the middle, but -1 unit the left from the center



i didn't think of it earlier because it behaves different when attached to one or two nodes.


i it seems to work but in the debug view, the joints are at the wrong location.

am i creating them wrong, or is that ok ?  :?



in the picture you see a Torus which is attached with 4 joints to the bar on top.

The joints also stay in that location (in debug view) even if the torus and bar move.



Setting the anchor is the right thing, of course. The debug viz should be in sync with the behavior, if it is not, that's a bug in the binding…

it seems i need to call rootNode.updateGeometricstate() inside the Gamestates render() method, to get the correct WorldTranslations for the Physics debug View.

But i think this shouldn't be necessary.



   public void render(float tpf) {
       super.render(tpf);
       if (showPhysics) {
           rootNode.updateGeometricState(0, false);
           PhysicsDebugger.drawPhysics(getPhysicsSpace(),
                   DisplaySystem.getDisplaySystem().getRenderer());
       }

   }

did you try to call updateGS only after creating the joints? with updateGS(0,true)



perhabs this is enough, but theoreticly the gameloop calls this method often enough

Interesting - it should not be necessary, yes. I need to take a look at it (which will be a while in the future, I'm afraid).

.:emp...hellg:. said:

did you try to call updateGS only after creating the joints? with updateGS(0,true)
perhabs this is enough, but theoreticly the gameloop calls this method often enough


yup updateGeometricstate() is called every update cycle and at the end of the GS Constructor, everything else seems to be right

i'll try to see where the WorldTranslation is reset.

I had a look into this. It seems PhysicsGameState does not adhere to the correct processing order for physics:

  1. update physics
  2. update input handlers
  3. application specific scenegraph modifications
  4. update scenegraph
  5. render



    Try to swap lines in it's update method to


   public void update(float tpf) {
      physics.update(tpf);
      super.update(tpf);
   }



Does that fix the problem?

ah, yes that does fix it, now the physics debug view is correct.