Here's a small example with the cone twist joints - arrow keys to move, left mouse to raise...
// set window properties
SetWindowTitle( "String" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
Create3DPhysicsWorld()
Set3DPhysicsGravity(0,-3,0)
global vec1,vec2
vec1=CreateVector3(0,0,0)
vec2=CreateVector3(0,0,0)
obj_body=CreateObjectsphere(12,8,8)
setobjectcolor(obj_body,255,64,64,255)
floor=Create3DPhysicsStaticPlane(0,1,0,0)
Create3DPhysicsDynamicBody(obj_body)
setobjectposition(obj_body,0,100,0)
objb=obj_body
SetObject3DPhysicsCanSleep(objb,0)
SetObject3DPhysicsMass(objb,10.0)
sz#=10.0
for l=1 to 64
obja=CreateObjectsphere(sz#,8,8)
j=mk_joint(obja,objb,0.0,0.0,l*sz#)
objb=obja
next l
for f=0 to 100
vo=createobjectplane(100,100)
setobjectcolor(vo,random(0,255),random(0,255),random(0,255),random(0,255))
setobjectposition(vo,random(0,1000)-500,random(0,255)*-0.01,random(0,1000)-500)
SetObjectRotation(vo,90,0,0)
next f
ready=-10
do
Step3DPhysicsWorld()
inc ready,1
lmb=mb
mb=getrawmouseleftstate()
obj=obj_body
sx#=GetObject3DPhysicslinearVelocityX(obj)
sy#=GetObject3DPhysicslinearVelocityY(obj)
sz#=GetObject3DPhysicslinearVelocityZ(obj)
mvz#=getrawkeystate(38)-getrawkeystate(40)
mvx#=getrawkeystate(39)-getrawkeystate(37)
inc sx#,mvx#*10
inc sz#,mvz#*10
if mb=1
inc sy#,10.0
endif
spd#=sqrt((sx#*sx#)+(sy#*sy#)+(sz#*sz#))
if spd#>100.0 then spd#=100.0
if ready>0 then SetObject3DPhysicslinearVelocity(obj,sx#,sy#,sz#,spd#)
setcameraposition(1,getobjectx(obj_body),getobjecty(obj_body),getobjectz(obj_body))
setcamerarotation(1,60,0,0)
movecameralocalz(1,-200)
Sync()
loop
function mk_joint(obja,objb,x#,y#,z#)
setobjectposition(obja,x#,y#,z#)
setvector3(vec1,x#,y#,z#)
setvector3(vec2,0,0,1)
Create3DPhysicsDynamicBody(obja)
j=Create3DPhysicsconetwistJoint(obja,objb,vec1,vec2,1)
Set3DPhysicsJointConeTwistLimits(j,30.0,30.0,30.0)
SetObject3DPhysicsMass(obja,1.0)
setobject3dphysicslinearvelocity(obja,random(-500,500)/1000.0,random(-500,500)/1000.0,random(-500,500)/1000.0,100.0)
SetObject3DPhysicsCanSleep(obja,0)
endfunction j