Tried using the script from the first scene in the third scene, and problem sort of solved (again no difference in the scripts as far as I can see). The models connect in the way they’re supposed to, but the bottom one falls a fair distance before the joint stops it.
Hinge.js and HingeConstraint.js: https://playcanvas.com/editor/code/532971?tabs=11402284,11566143
EDIT: Found the problem, but not sure what is causing it.
var offsetB = new pc.Vec3();
var matrixB = this.partB.getWorldTransform().clone();
Somewhere and somehow between getting the world transform matrix and inverting it, the matrix changes. This happens both with the original script and mine in the scene below. The difference being my script makes the second part go above the first, while the original does the opposite (like it’s supposed to), but it goes too far.
Opening the debug console here will display the matrices.