Sorry I found those commands just after I posted
here's the code I've been messing with but I can get "phy set sphere joint spring ID, target#, spring#" to do much
what should I set the target value to?
sync on
sync rate 60
autocam off
set camera range 1,1000
set normalization on
hide mouse
global jointID as integer : jointID = 0
global zoom# as double float : zoom# = -30
global ammoID as integer
global mtimer as integer
phy start
id = 1
id = makeLevel(id,125)
id = createRagDoll(id,0,11,0)
ammoID = 5000
null = mousemovex()
null = mousemovey()
make light 1
set directional light 1, -5,-5,5
position camera 0,10,-30
make object sphere 1000,400,48,48
color object 1000,RGB(0,0,128)
scale object texture 1000,6,6
set object cull 1000,0
rotate object 1000,0,0,90
color object 1,RGB(0,0,255)
offset = 20
counter = 500
position camera 0,50,-50
do
rotate object 1000, 0, object angle y( 1000 ) - 0.3, 0
gosub userInput
controlShooting()
phy update
circle 400,300,10
dot 400,300
sync
loop
function controlCamera()
endfunction
userInput:
` simple mouse and keyboard movement
` store old camera angle
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
` store new camera angle
CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.4 )
CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.4 )
` rotate camera
yrotate camera curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
xrotate camera curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
` speed up movement
if inkey$ ( ) = "+"
if g_fSpeed# < 1000
g_fSpeed# = g_fSpeed# + 0.01
endif
endif
` slow down movement
if inkey$ ( ) = "-"
if g_fSpeed# > 0.002
g_fSpeed# = g_fSpeed# - 0.001
endif
endif
position mouse 400, 300
return
function controlShooting()
if mouseclick()=1 and mtimer<timer()
mtimer = timer()+300
angy# = camera angle y()
angx# = -camera angle X()
make object sphere ammoID,1
position object ammoID,camera position x(),camera position y(),camera position z()
phy make rigid body dynamic sphere ammoID
phy set rigid body linear velocity ammoID, 150*sin(angy#)*cos(angx#),150*sin(angx#),150*cos(angy#)*cos(angx#)
phy set rigid body mass ammoID, 500
color object ammoID, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular ammoID, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power ammoID, 255
set object ambient ammoID,0
inc ammoID
endif
endfunction
function makeLevel(id,x)
make object box id,x,2,x
color object id,rgb(100,100,100)
position object id,0,-10,0
phy make rigid body static box id
inc id
make object box id,2,x,x
position object id,-(x/2),20,0
phy make rigid body static box id
inc id
make object box id,2,x,x
position object id,x/2,20,0
phy make rigid body static box id
inc id
make object box id,x,x,2
position object id,0,20,x/2
phy make rigid body static box id
inc id
make object box id,x,x,2
position object id,0,20,-(x/2)
phy make rigid body static box id
inc id
endfunction id
function createRagDoll(id,x, y, z)
firstID = ID
rem torso
makeObjectCapsule(id,4,2.6)
scale object id,100,70,100
position object id,0+x,11+y,0+z
phy make rigid body dynamic box id
body = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem lower torso
makeObjectCapsule(id,4,2.55)
scale object id,100,70,100
position object id,0+x,9.5+y,0+z
phy make rigid body dynamic box id
Lbody = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem head
headID = id
makeObjectCapsule(id,2,1.5)
position object id,0+x,14+y,0+z
phy make rigid body dynamic box id
head = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left upper arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,2.75+x,12+y,0+z
phy make rigid body dynamic box id
leftUarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left lower arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,5.5+x,12+y,0+z
phy make rigid body dynamic box id
leftLarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right upper arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,-2.75+x,12+y,0+z
phy make rigid body dynamic box id
rightUarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right lower arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,-5.5+x,12+y,0+z
phy make rigid body dynamic box id
rightLarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left upper leg
makeObjectCapsule(id,2.5,1.2)
position object id,0.75+x,6+y,0+z
phy make rigid body dynamic box id
leftUleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left lower leg
makeObjectCapsule(id,2.5,1)
position object id,0.75+x,3+y,0+z
phy make rigid body dynamic box id
leftLleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right upper leg
makeObjectCapsule(id,2.5,1.2)
position object id,-0.75+x,6+y,0+z
phy make rigid body dynamic box id
rightUleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right lower leg
makeObjectCapsule(id,2.5,1)
position object id,-0.75+x,3+y,0+z
phy make rigid body dynamic box id
rightLleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
strength = 150
i=jointID
rem join the limbs together - ball and sockets
phy make sphere joint i,body,leftUarm,1.5+x,12 + y,0+z
phy set sphere joint spring i,180,10000
phy build sphere joint i
phy make sphere joint i+1,body,rightUarm,-1.5+x,12 + y,0+z
phy set sphere joint spring i+1,180,10000
phy build sphere joint i+1
phy make sphere joint i+2,Lbody,leftUleg,0.75+x,7.5 + y,0+z
phy set sphere joint spring i+2,180,10000
phy build sphere joint i+2
phy make sphere joint i+3,Lbody,rightUleg,-0.75+x,7.5 + y,0+z
phy set sphere joint spring i+3,180,10000
phy build sphere joint i+3
rem elbows and knees
phy make revolute joint i+4,leftUarm,leftLarm, 0, 1, 0, 4+x,12 + y,0+z
phy set revolute joint spring i+4,0,10000
phy build revolute joint i+4
phy make revolute joint i+5,rightUarm,rightLarm, 0, 1, 0, -4+x,12 + y,0+z
phy set revolute joint spring i+5,0,10000
phy build revolute joint i+5
phy make revolute joint i+6,leftUleg,leftLleg, 1, 0, 0, 0.75+x,4.6 + y,0+z
phy set revolute joint spring i+6,0,10000
phy build revolute joint i+6
phy make revolute joint i+7,rightUleg,rightLleg, 1, 0,0,-0.75+x,4.6 + y,0+z
phy set revolute joint spring i+7,0,10000
phy build revolute joint i+7
rem head and body
phy make revolute joint i+8,body,head, 1, 0,0,0+x,13 + y,0+z
phy make revolute joint i+9,body,Lbody, 1,0,0,0+x,10.3 + y,0+z
rem future update - add limit joints to restrict movement
rem - add motors?
inc jointID,10
endfunction id
function makeObjectCapsule(obj, h#, r#)
h# = h# - r#
if h#<0 then exitfunction
rem rows must be odd
rows = 11
cols = 16
make object sphere obj,r#,rows,cols
lock vertexdata for limb obj,0,1
for i=0 to get VertexData Vertex Count()
x#=get VertexData Position X(i)
y#=get VertexData Position Y(i)
z#=get VertexData Position Z(i)
if y#>0
set VertexData Position i,x#,y#+h#,z#
else
set VertexData Position i,x#,y#-h#,z#
endif
next i
unlock vertexdata
make mesh from object 1,obj
delete object obj
make object obj,1,0
delete mesh 1
endfunction
function strapline(mode,s$)
if mode=0
ink 0x88FFFFFF,0 : set text font "Tahoma" : set text size 32
else
center text screen width()/2,20,s$
endif
endfunction
Edit:
Here's An improved version it stands!! (kind of
)
sync on
sync rate 60
autocam off
set camera range 1,1000
set normalization on
hide mouse
global jointID as integer : jointID = 0
global zoom# as double float : zoom# = -30
global ammoID as integer
global mtimer as integer
phy start
id = 1
id = makeLevel(id,125)
id = createRagDoll(id,0,11,0)
ammoID = 5000
null = mousemovex()
null = mousemovey()
make light 1
set directional light 1, -5,-5,5
position camera 0,10,-30
make object sphere 1000,400,48,48
color object 1000,RGB(0,0,128)
scale object texture 1000,6,6
set object cull 1000,0
rotate object 1000,0,0,90
color object 1,RGB(0,0,255)
offset = 20
counter = 500
position camera 0,50,-50
do
rotate object 1000, 0, object angle y( 1000 ) - 0.3, 0
gosub userInput
controlShooting()
if upkey()=1 then move camera 1
if downkey()=1 then move camera -1
phy update
circle 400,300,10
dot 400,300
sync
loop
function controlCamera()
endfunction
userInput:
` simple mouse and keyboard movement
` store old camera angle
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
` store new camera angle
CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.4 )
CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.4 )
` rotate camera
yrotate camera curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
xrotate camera curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
` speed up movement
if inkey$ ( ) = "+"
if g_fSpeed# < 1000
g_fSpeed# = g_fSpeed# + 0.01
endif
endif
` slow down movement
if inkey$ ( ) = "-"
if g_fSpeed# > 0.002
g_fSpeed# = g_fSpeed# - 0.001
endif
endif
position mouse 400, 300
return
function controlShooting()
if mouseclick()=1 and mtimer<timer()
mtimer = timer()+300
angy# = camera angle y()
angx# = -camera angle X()
make object sphere ammoID,1
position object ammoID,camera position x(),camera position y(),camera position z()
phy make rigid body dynamic sphere ammoID
phy set rigid body linear velocity ammoID, 150*sin(angy#)*cos(angx#),150*sin(angx#),150*cos(angy#)*cos(angx#)
phy set rigid body mass ammoID, 500
color object ammoID, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular ammoID, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power ammoID, 255
set object ambient ammoID,0
inc ammoID
endif
endfunction
function makeLevel(id,x)
make object box id,x,2,x
color object id,rgb(100,100,100)
position object id,0,-10,0
phy make rigid body static box id
inc id
make object box id,2,x,x
position object id,-(x/2),20,0
phy make rigid body static box id
inc id
make object box id,2,x,x
position object id,x/2,20,0
phy make rigid body static box id
inc id
make object box id,x,x,2
position object id,0,20,x/2
phy make rigid body static box id
inc id
make object box id,x,x,2
position object id,0,20,-(x/2)
phy make rigid body static box id
inc id
endfunction id
function createRagDoll(id,x, y, z)
firstID = ID
rem torso
makeObjectCapsule(id,4,2.6)
scale object id,100,70,100
position object id,0+x,11+y,0+z
phy make rigid body dynamic box id
phy set rigid body kinematic id,1
body = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem lower torso
makeObjectCapsule(id,4,2.55)
scale object id,100,70,100
position object id,0+x,9.5+y,0+z
phy make rigid body dynamic box id
Lbody = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem head
headID = id
makeObjectCapsule(id,2,1.5)
position object id,0+x,14+y,0+z
phy make rigid body dynamic box id
head = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left upper arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,2.75+x,12+y,0+z
phy make rigid body dynamic box id
leftUarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left lower arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,5.5+x,12+y,0+z
phy make rigid body dynamic box id
leftLarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right upper arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,-2.75+x,12+y,0+z
phy make rigid body dynamic box id
rightUarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right lower arm
makeObjectCapsule(id,2,0.85)
zrotate object id,90
position object id,-5.5+x,12+y,0+z
phy make rigid body dynamic box id
rightLarm = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left upper leg
makeObjectCapsule(id,2.5,1.2)
position object id,0.75+x,6+y,0+z
phy make rigid body dynamic box id
leftUleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem left lower leg
makeObjectCapsule(id,2.5,1)
position object id,0.75+x,3+y,0+z
phy make rigid body dynamic box id
leftLleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right upper leg
makeObjectCapsule(id,2.5,1.2)
position object id,-0.75+x,6+y,0+z
phy make rigid body dynamic box id
rightUleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
rem right lower leg
makeObjectCapsule(id,2.5,1)
position object id,-0.75+x,3+y,0+z
phy make rigid body dynamic box id
rightLleg = id
color object id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular id, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power id, 255
set object ambient id,0
inc id
strength = 150
i=jointID
rem join the limbs together - ball and sockets
phy make sphere joint i,body,leftUarm,1.5+x,12 + y,0+z
phy set sphere joint spring i,0,10000
phy build sphere joint i
phy make sphere joint i+1,body,rightUarm,-1.5+x,12 + y,0+z
phy set sphere joint spring i+1,0,10000
phy build sphere joint i+1
phy make sphere joint i+2,Lbody,leftUleg,0.75+x,7.5 + y,0+z
phy set sphere joint spring i+2,0,10000
phy build sphere joint i+2
phy make sphere joint i+3,Lbody,rightUleg,-0.75+x,7.5 + y,0+z
phy set sphere joint spring i+3,0,10000
phy build sphere joint i+3
rem elbows and knees
phy make revolute joint i+4,leftUarm,leftLarm, 0, 1, 0, 4+x,12 + y,0+z
phy set revolute joint spring i+4,0,100
phy build revolute joint i+4
phy make revolute joint i+5,rightUarm,rightLarm, 0, 1, 0, -4+x,12 + y,0+z
phy set revolute joint spring i+5,0,100
phy build revolute joint i+5
phy make revolute joint i+6,leftUleg,leftLleg, 1, 0, 0, 0.75+x,4.6 + y,0+z
phy set revolute joint spring i+6,0,1000
phy build revolute joint i+6
phy make revolute joint i+7,rightUleg,rightLleg, 1, 0,0,-0.75+x,4.6 + y,0+z
phy set revolute joint spring i+7,0,1000
phy build revolute joint i+7
rem head and body
phy make revolute joint i+8,body,head, 1, 0,0,0+x,13 + y,0+z
phy set revolute joint spring i+8,0,1000
phy build revolute joint i+8
phy make revolute joint i+9,body,Lbody, 1,0,0,0+x,10.3 + y,0+z
phy set revolute joint spring i+9,0,1000
phy build revolute joint i+9
rem future update - add limit joints to restrict movement
rem - add motors?
inc jointID,10
endfunction id
function makeObjectCapsule(obj, h#, r#)
h# = h# - r#
if h#<0 then exitfunction
rem rows must be odd
rows = 11
cols = 16
make object sphere obj,r#,rows,cols
lock vertexdata for limb obj,0,1
for i=0 to get VertexData Vertex Count()
x#=get VertexData Position X(i)
y#=get VertexData Position Y(i)
z#=get VertexData Position Z(i)
if y#>0
set VertexData Position i,x#,y#+h#,z#
else
set VertexData Position i,x#,y#-h#,z#
endif
next i
unlock vertexdata
make mesh from object 1,obj
delete object obj
make object obj,1,0
delete mesh 1
endfunction
function strapline(mode,s$)
if mode=0
ink 0x88FFFFFF,0 : set text font "Tahoma" : set text size 32
else
center text screen width()/2,20,s$
endif
endfunction