Joode universal joint

Is there an implemenation of the universal joint type in joode? I’ve tried do it with a JointConfigurable, but that results in explosions. Here’s the code I’m using, where the coordinate system is that imposed by Xith (x viewer right, y local gravity up, z out of screen).


    JointConfigurable hip = new JointConfigurable(getWorld());
    hip.attach(torsoBody, thighBody);
    hip.setAnchor1(new Vector3(sign * TORSO_RADIUS, TORSO_LENGTH/2, 0)); //relative to torso center
    hip.setAnchor2(new Vector3(sign * THIGH_WIDTH, -THIGH_WIDTH/2, THIGH_LENGTH/2)); //relative to thigh center
    
    hip.angularConstraints[0] = JointConfigurable.MOTOR_CONSTRAINT; //X, Pitch has motor
    hip.angularConstraints[1] = JointConfigurable.UNBOUNDED_CONSTRAINT; //Y, Yaw is unbounded
    hip.angularConstraints[2] = JointConfigurable.MOTOR_CONSTRAINT; //Z, Roll has motor

If anyone has just a simple universal joint class, or advice on how to implement it with JointConfigurable, I’d be very appreciative. Thanks,

  • Josh

Oh sorry. JointConfigurable is not working correctly yet. Angular constraints are playing up.
A universal joint has all 3 linear DOFs constrained, plus one constrained angular DOF. Two angular DOFs are unconstrained. From your code I think you want the two unconstrained angular DOFs motored. Hmmm, which means you want some kind of constraint on all three angular DOFs. JointConfigurable can’t handle this, I can’t work out the proper math yet, angles are funny :confused:
I think the much easier way for your system until this is fixed, is to use hinge joints with dummy bodies inbetween.

PS I think the initial cause fo your explosions is probably that your anchors are not actually where your bodies are relative to one another. There are a couple of methods called something like getAnchor1InGlobalFrame. This should be equal to getAnchor2InGlobalFrame before you start steppiong the world. You could probably fix that, but you will still run into problems.

Tom