Hey Everyone,
Been struggling with the 3d physics trying to do what I thought was simple (I have successfully done it with the 2d Phyics before)
I'm trying to make a pinball flipper mechanism. <y approach has been to create a hinge joint, with angle limits. But from here, all my approaches seem to not work. Setting impulses, clamping the angle, setting the hinge motor velocity in the main loop seems to stop the physics from updating. Not sure how to best tackle this now, hopefully someone here can help
I didn't go the kinematic body route because the rotating at the flipper at a "realistic" speed caused spheres to not collide more often then not. I assume since updating the rotation values is limited by the game update time versus physics which updates sub frames?
Here is the basic setup of the flipper, with "pin" object to pivot around, etc.
Create3DPhysicsWorld()
pin = CreateObjectCylinder(4,1,12)
create3DPhysicsStaticBody(pin)
flipper = loadObject("flipper.fbx")
Create3DPhysicsDynamicBody( flipper )
SetObject3DPhysicsCanSleep( flipper, 0 )
rotVec=CreateVector3(0.0,1.0,0.0)
posVec=CreateVector3()
Joint = Create3DPhysicsHingeJoint( flipper, pin, posVec, rotVec, 1 )
Set3DPhysicsJointHingeLimits( Joint, -30.0, 40.0 )
Set3DPhysicsHingeJointMotorIsEnabled( Joint, 1 )
do
//On Click
if GetPointerPressed()
//Call Velocity?
//Set Max Impulse?
endif
//On Release
if GetPointerReleased()
endif
Step3DPhysicsWorld()
Print( ScreenFPS() )
Sync()
loop
Hope a wise AGK'er can help