HingeJoint tutorial mistake

In this tutorial hinges_and_joints, there’s a bug in the code (that doesn’t affect the result). (I’m pretty sure the code is wrong and I’m right…)



The pendulumNode is placed at (0,-1,0) and it’s pivot point is also set at (0,-1,0), but should be (0,1,0). The pivot point is the relative position of the hinge joint. The global position of the hinge is (0,0,0), thus in pendulumNodes frame that is at (0,1,0). The code that goes with it: http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java has the same bug.



This isn’t an actual problem, because before you see anything, the HingeJoint constraint is enforced and the pendulumNode (or hammerNode) gets set to the opposite position (0,1,0). The tutorial explanation isn’t really accurate either:


Vector3f pivot A and pivot B – coordinates of the two attachment points


More accurate would be: "the attachment point in A and B local space".

I could fix the tutorial (wiki ftw) but not the code... and if both say something different, it might be only more confusing? Shall I fix the tutorial?
1 Like

Yeah, go ahead and fix it, you’re right. Thanks :slight_smile:

1 Like