Thank you for the replies and I am now looking at this in a different light, however I still cannot get it to work properly. The text from the link provided by VN references the following:
Max Motor Force - I believe this is the
Set3DPhysicsHingeJointMaxMotorImpulse() value? Would this be what ties the mass of the object to the amount of rotation in degrees per step?
Target Velocity - I believe this is the
Set3DPhysicsHingeJointMotorVelocity() part of our hinge joint? Is this the angle in degrees we want the door to rotate?
Is this how you understand it? I am still leaning on there being a problem with this operation in general and will need to work with the max speeds I can get at a 45deg angle...
EDIT - ok so the problem turned out to be the angle limits. I was using -45 - 45, but changing that to 315 - 45 seems to solve the issue. This is slightly contrary to the documentation that states "To unlock the joint set the lower limit greater than upper limit."
Ont thing of note, you do need to apply a Set3DPhysicsHingeJointMaxMotorImpulse() before the Set3DPhysicsHingeJointMotorVelocity() command will work. So my original approach of the Impulse acting as the ramp-per-step appears to be somewhat correct, although you can get movement from the object by repeatedly applying the Impulse() so more to learn I guess.
Final code here, its flippin' fast now
// Project: hingeJointMotor
// Created: 20-07-02
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "hingeJointMotor" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
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(20)
Create3DPhysicsWorld(1)
hinge_post = CreateObjectCylinder(6, 1, 8)
SetObjectColor(hinge_post, 89, 100, 255, 255)
Create3DPhysicsStaticBody(hinge_post)
hinge_door = CreateObjectBox(4, 1, 0.25)
SetObjectPosition(hinge_door, 2.5, 3, 0)
SetObjectColor(hinge_door, 0, 17, 255, 255)
Create3DPhysicsDynamicBody(hinge_door)
SetObject3DPhysicsCanSleep(hinge_door, 0)
SetObject3DPhysicsMass(hinge_door, 1) //Declared mass for object (from VN 2020-07-03)
hinge_joint = Create3DPhysicsHingeJoint(hinge_post, hinge_door, CreateVector3(0,3,0), CreateVector3(0,1,0), 0)
Set3DPhysicsJointHingeLimits(hinge_joint, 315, 45) //Previously this was -45 to 45 (change 2020-07-04) ******
Set3DPhysicsHingeJointMotorIsEnabled(hinge_joint, 1)
Set3DPhysicsHingeJointMaxMotorImpulse(hinge_joint, 50)
do
Print("< and > to operate hinge joint @ 125")
Print("Left and Right to operate hinge joint @ 150")
Print(str(GetObjectAngleY(hinge_door)))
if GetRawKeyPressed(188) //"<"
Set3DPhysicsHingeJointMotorVelocity(hinge_joint, 125)
endif
if GetRawKeyPressed(190) //">"
Set3DPhysicsHingeJointMotorVelocity(hinge_joint, -125)
endif
if GetRawKeyPressed(37) //"Left"
Set3DPhysicsHingeJointMotorVelocity(hinge_joint, 400)
endif
if GetRawKeyPressed(39) //"Right"
Set3DPhysicsHingeJointMotorVelocity(hinge_joint, -400)
endif
Step3DPhysicsWorld()
Sync()
loop