this might help you, it a demo like the physx demo in the SDK, some of it values have words instead of values to show how to lock something.
I think you have work out most of this, but it might give you a clue as to what to do next.
Rem Project: samplejoints
Rem Created: 16/03/2009 08:16:19
Rem ***** Main Source File *****
set window on
set window title "Smaple Joints"
sync on
sync rate 60
autocam off
phy enable debug
position camera -20,10,10
point camera -10,0,0
`rotate camera 20,0,0
phy start
phy set Gravity 0.0, -1.0, 0.0
ground=1
PENDULUM_COUNT = 5
BALL_COUNT = 6
hammer=9
wheelPivot=10
rodPivot=11
dim pendulum(PENDULUM_COUNT)
driveJoint=12
pushbacksphere=13
pushbackcube=14
movefree=1
locked=0
firstobject=0
secondobject=1
dim ball(BALL_COUNT)
rem make material for ground
PHY MAKE MATERIAL 1, "defaultMaterial"
PHY SET MATERIAL RESTITUTION 1,0.0
PHY SET MATERIAL STATIC FRICTION 1, 0.5
PHY SET MATERIAL DYNAMIC FRICTION 1, 0.5
rem the ground
make object box ground,100,1,100
position object ground,0,-1,0
color object ground,RGB(0,128,255)
phy make rigid body static box ground,1
rem center cube that rotate on x axis
make object cube pushBackcube,1
position object pushbackcube,0,.2,0
phy make rigid body dynamic box pushBackcube
PHY SET RIGID BODY MASS pushBackcube, 10.0
rem outside cube the is fixed and rotate with first object
make object cube wheelPivot,1
position object wheelPivot, 0,2,0
phy make rigid body dynamic box wheelPivot
rem stop it turning
PHY SET RIGID BODY KINEMATIC wheelPivot,1
rem link them together
PHY MAKE FIXED JOINT 1,wheelPivot ,pushBackcube
rem link sphere
make object sphere rodPivot,1
position object rodPivot,0,0,-10
phy make rigid body dynamic sphere rodPivot
rem link outside cube to sphere
phy make distance joint 2, pushBackcube,rodPivot
phy set distance joint min 2, 10.0: rem keeps the distance
phy set distance joint max 2, 10.0 :rem keeps the distance
phy build distance joint 2
rem make the hammer
make object cube hammer,1
position object hammer,0,0,-15
phy make rigid body dynamic box hammer
PHY MAKE FIXED JOINT 3,rodPivot,hammer
PHY MAKE FIXED JOINT 4,hammer,rodPivot
rem counting vars d=distance
rem j joint numbers
`phy make cylindrical joint 30, rodPivot,hammer, object position x ( rodPivot), object position y (rodPivot ), object position z (rodPivot ), 0, 5, 0
phy make prismatic joint 5, rodPivot,hammer,locked,locked,locked, object position x (rodpivot), object position y (rodpivot), object position z (rodpivot)
phy make prismatic joint 6, hammer,rodpivot,locked,locked,locked, object position x (hammer), object position y (hammer), object position z (hammer)
`prismatic
d=1
j=40
distance#=10.0
for c= 15 to 25 step 2
rem make swing boxes anchor
of=rnd(200)/100
make object sphere c, 1
position object c, -.5+of, 5,-18-(d*4)
phy make rigid body static sphere c
rem make boxes to swing
make object cube c+1, 1
position object c+1, -.5+of, 0.5,-18-(d*4)
phy make rigid body dynamic box c+1
PHY SET RIGID BODY MASS c+1, -2
`phy make sphere joint j, c, c+1
phy make sphere joint j, c, c + 1, object position x ( c ), object position y ( c ), object position z ( c )
rem add one
inc d
inc j
next c
rem load object numbers into varable
for i=1 to 6
ball(i)=99+i
next i
rem set count
count=1
do
phy update 1
text 0,0,"arrow keys to move view about."
rem keep shphere and box straight.
phy set rigid body position hammer,0,0,object position z(hammer)
phy set rigid body position rodPivot,0,0,object position z(rodpivot)
rem rotate box
PHY SET RIGID BODY ROTATION wheelPivot,wrapvalue(object angle x(wheelpivot)+1),0,0
`inc x#,2
rem put a sphere on screen when box pulls bac k
if object position z(hammer)>-13.0 and hold<>1
hold=1
if object exist(ball(count))<>1
make object sphere ball(count),1
position object ball(count),0,0,-15
phy make rigid body dynamic sphere ball(count)
PHY SET RIGID BODY MASS ball(count), 30
PHY SET RIGID BODY LINEAR DAMPING ball(count),.10
inc count,1
endif
if object exist(ball(count))=1
rem position object
phy set rigid body position ball(count),0,.5,-15
inc count,1
endif
if count>4
count=1
endif
endif
if object position z(hammer)<=-16.0
hold=0
endif
PHY SET RIGID BODY ANGULAR MOMENTUM rodPivot, 0,PHY GET RIGID BODY ANGULAR MOMENTUM Y(rodPivot),PHY GET RIGID BODY ANGULAR MOMENTUM z(rodPivot)
rem draw connecting lines
line object screen x(pushBackcube),object screen y( pushBackcube),object screen x(rodPivot),object screen y( rodPivot)
line object screen x(rodPivot),object screen y( rodPivot),object screen x(hammer),object screen y(hammer)
for k=15 to 25 step 2
line object screen x(k ),object screen y(k ),object screen x(k+1 ),object screen y(k+1 )
next k
text object screen x(wheelPivot)-150,object screen y(wheelPivot)-15,"Rotation point"
center text object screen x(pushBackcube),object screen y(pushBackcube)-15,"Fixed Joint"
center text object screen x(rodPivot),object screen y(rodPivot)+15,"distance Joint"
text object screen x(hammer)+10,object screen y(hammer)," <- prismatic joint"
center text object screen x(15),object screen y(15)-25,"sphere Joint"
rem
control camera using arrowkeys 0,.1,.1
phy update 0
sync
loop
[edit]
I realies this not what you are asking however it might have the answer.
[/edit]
Dark Physics makes any hot drink go cold.