I think I figured out the connection between the angle of the object you are spinning on the hinge, and the rotation vector you need to set when making the hinge. I was following this thread:
https://forum.thegamecreators.com/thread/221240 and was just playing around with a calculator to come up with this, it seems to work fine for a "hanging" type hinge (ie haven't tried doors on weird angles.) May be a useful starting point for anyone out there trying to have things spin on anything other than right angles, in the code below you can set the angle on line 33 to test out.
// Project: hingeSpin
// Created: 21-04-30
SetErrorMode(2)
SetWindowTitle( "hingeSpin" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
SetVirtualResolution( 800, 600 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )
SetPrintSize(18)
create3DPhysicsWorld(1)
Set3DPhysicsGravity(0, -40, 0)
SetAmbientColor(50, 50, 50)
MoveCameraLocalZ(1, 5)
myfloor = CreateObjectPlane(48, 48)
SetObjectColor(myFloor, 66, 66, 66, 255)
RotateObjectLocalX(myFloor, 90)
Create3DPhysicsStaticBody(myFloor)
SetObject3DPhysicsFriction(myFloor, 0.5)
myMover = CreateObjectBox(2, 2, 2)
SetObjectColor(myMover, 150, 89, 255, 255)
SetObjectPosition(myMover, 0, 3, 0)
Create3DPhysicsDynamicBody(myMover)
SetObject3DPhysicsFriction(myMover, 0.25)
SetObject3DPhysicsCanSleep(myMover, 0)
hangerAngle as float = 100.0 //Adjust the angle here
hangerPost = CreateObjectCylinder(4, 0.25, 16)
SetObjectColor(hangerPost, 6, 68, 127, 255)
RotateObjectLocalX(hangerPost, 90)
FixObjectPivot(hangerPost)
SetObjectPosition(hangerPost, 5, 4, 0)
RotateObjectLocalY(hangerPost, hangerAngle)
Create3DPhysicsStaticBody(hangerPost)
hangerSwing = CreateObjectBox(0.25, 3.5, 2)
SetObjectColor(hangerSwing, 57, 146, 229, 255)
SetObjectPosition(hangerSwing, GetObjectX(hangerPost), GetObjectY(hangerPost) - abs(GetObjectMeshSizeMinY(hangerSwing, 1)), GetObjectZ(hangerPost))
RotateObjectLocalY(hangerSwing, hangerAngle)
Create3DPhysicsDynamicBody(hangerSwing)
vecPos = CreateVector3()
vecRot = CreateVector3()
SetVector3(vecPos, GetObjectX(hangerPost), GetObjectY(hangerPost), GetObjectZ(hangerPost))
SetVector3(vecRot, Sin(hangerAngle), 0, Cos(hangerAngle))
hangerJoint = Create3DPhysicsHingeJoint(hangerPost, hangerSwing, vecPos, vecRot, 1)
do
print("-- Move box with arrow keys --" + chr(10))
print("GetObjectAngleX(hangerSwing) = " + str(GetObjectAngleX(hangerSwing)))
print("GetObjectAngleY(hangerSwing) = " + str(GetObjectAngleY(hangerSwing)))
print("GetObjectAngleZ(hangerSwing) = " + str(GetObjectAngleZ(hangerSwing)) + chr(10))
print("GetVector3X(vecRot) = " + str(GetVector3X(vecRot)))
print("GetVector3Y(vecRot) = " + str(GetVector3Y(vecRot)))
print("GetVector3Z(vecRot) = " + str(GetVector3Z(vecRot)))
print("GetVector3Length(vecRot) = " + str(GetVector3Length(vecRot)))
if (GetRawKeyState(38)) then SetObject3DPhysicsLinearVelocity(myMover, 0, 0, 1, 5)
if (GetRawKeyState(40)) then SetObject3DPhysicsLinearVelocity(myMover, 0, 0, -1, 5)
if (GetRawKeyState(37)) then SetObject3DPhysicsLinearVelocity(myMover, -1, 0, 0, 5)
if (GetRawKeyState(39)) then SetObject3DPhysicsLinearVelocity(myMover, 1, 0, 0, 5)
Step3DPhysicsWorld()
Sync()
loop