added crane bucket up and down plus tesxt to say what does what and put the stop limits in it.
when I get to it, it will have lots of spheres to pick up instead of dropping.
Rem Project: crane1
Rem Created: 13/03/2009 15:58:49
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
phy enable debug
position camera 0,10,-35
point camera 0,0,0
phy start
rem make ground
make object box 1,100,2,100
position object 1,0,-7,0
phy make rigid body static box 1
rem right bucket
load object "buck1.x",10
position object 10,-1,10,0
color object 10,rgb(255,255,0)
x#=object size x(10)
fix object pivot 10
phy load rigid body dynamic mesh 10,"tuckRight.x",0
rem left bucket
clone object 12,10
position object 12,1,10,0
rotate object 12,0,180,0
fix object pivot 12
phy load rigid body dynamic mesh 12,"tuckLeft.x",0
PHY SET RIGID BODY ROTATION 12, 0, 180, 0
rem make connecting box
make object box 13,.65,.5,1
position object 13,0,14.2,0
color object 13,rgb(0,255,0)
phy make rigid body dynamic box 13
PHY SET RIGID BODY KINEMATIC 13,1
rem make top block
make object box 14,1,.5,1
position object 14,0,17.5,0
color object 14,rgb(255,0,0)
phy make rigid body dynamic box 14
PHY SET RIGID BODY KINEMATIC 14,1
` create a cylinder joint between the bucket and block
PHY MAKE CYLINDRICAL JOINT 1, 13, 10, -0.2, 14.2 , 0, 0,0,1 :rem left
PHY MAKE CYLINDRICAL JOINT 2, 13, 12, 0.2, 14.2 , 0, 0,0,1 :rem rightt
rem conncet top bar to top block
PHY MAKE CYLINDRICAL JOINT 3, 14, 10, -0.2, 17.5, 0, 0,0,1 :rem left
PHY MAKE CYLINDRICAL JOINT 4, 14, 12, 0.2, 17.5 , 0, 0,0,1 :rem right
rem stop object twisting
PHY MAKE FIXED JOINT 5, 14, 10
PHY MAKE FIXED JOINT 6, 14, 12
PHY BUILD FIXED JOINT 5
PHY BUILD FIXED JOINT 6
rem sphere put in bucket
make object sphere 100,1.3
position object 100,0,11.5,1
phy make rigid body dynamic sphere 100
make object sphere 101,1.3
position object 101,0,11.5,-1
phy make rigid body dynamic sphere 101
y#=object position y(13)
y1#=object position y(13)
y2#=object position y(14)
upstopy#=y#
downstopy#=y#-2.0
do
text 0,0,"pageup/down to move all up and down"
text 0,10,"w to close bucket"
text 0,20,"s to open bucket"
phy update 1
if keystate(201)=1
PHY SET RIGID BODY KINEMATIC POSITION 13, 0, y1#, 0
PHY SET RIGID BODY KINEMATIC POSITION 14, 0,y2#, 0
inc y1#,.1
inc y2#,.1
y#=object position y(13)
endif
if keystate(209)=1
PHY SET RIGID BODY KINEMATIC POSITION 13, 0, y1#, 0
PHY SET RIGID BODY KINEMATIC POSITION 14, 0, y2#, 0
dec y1#,.1
dec y2#,.1
y#=object position y(13)
endif
if keystate(17)=1
if y#=>upstopy# then y#=upstopy#
PHY SET RIGID BODY KINEMATIC POSITION 13, 0, y#, 0
inc y#,.01
y1#=object position y(13)
endif
if keystate(31)=1
if y#=<downstopy# then y#=downstopy#
PHY SET RIGID BODY KINEMATIC POSITION 13, 0, y#, 0
dec y#,.01
y1#=object position y(13)
endif
control camera using arrowkeys 0,1,1
phy update 0
sync
loop
Dark Physics makes any hot drink go cold.