not sure what you where hoping for but have added
idd=pick object(mousex(),mousey(),startid,lastid)>0
d#=get pick distance()
pick screen mousex(), mousey(), d#
to your code.
Rem Project: shootball
Rem Created: 07/02/2009 14:48:19
Rem ***** Main Source File *****
` create a stack of boxes
temp = make vector3(1)
` start the physics simulation
phy start
` set the sync on and sync rate to 0 so we control the updating of the screen and it is
` drawn to as fast as possible
sync on
sync rate 200
` make background
`load image "stripe5.png",1000
make object sphere 1000,400,48,48
`texture object 1000,1000
scale object texture 1000,6,6
set object cull 1000,0
rotate object 1000,0,0,90
` create an object to be used as the ground, it is the positioned and a rigid body box is
` created to represent it, its dynamic state is then set to 0
`load image "stripe6.png", 3
make object box 5, 10, 0.5, 10
position object 5, 0, -0.5, 0
phy make rigid body static box 5
`texture object 5, 3
make object sphere 10,.2
` next we create our stack of objects to sit on top of the ground, the "levels" variable
` controls how many levels we have in our stack, the "ID" variable stores the ID number
` of the object, we begin at ID 2 as we already have an object using ID 1
levels = 25
ID = 50
startid=id
` run a loop through all of the levels
for y = 0 to levels
for x = 0 to levels - y
` make a cube and give it a random colour
make object cube ID, 0.2
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
` determine the position of the cube
a# = 0.2
b# = 1.5
` xpos# = ( x + 0.5 * y ) * a# - b#
` ypos# = y
` zpos# = 0
` position the cube
position object ID, ( x + 0.5 * y ) * 0.2 - 1.5, (y-.7) * 0.19 , 0
` create a rigid body box to represent the cube
phy make rigid body dynamic box ID
` increment the ID variable
inc ID
next x
next y
lastid=id
` turn autocam off
autocam off
` position the camera so we can view the whole scene
position camera 0.5, 2, -4
move camera -4
` create a light
make light 1
set directional light 1, -5,-5,5
a# = 0.0
b# = 0.0
c# = 0.0
` display Dark Physics logo
`load image "logo.png", 100000
`sprite 1, 0, 600 - 60, 100000
` now we get to our main program loop
do
a# = wrapvalue( a# + 1.5 )
b# = wrapvalue( b# + 1.2 )
c# = wrapvalue( c# + 0.5 )
x# = cos ( c# ) * 8.0
z# = sin ( c# ) * 10.0
position light 0, x#, 4, z#
point light 0, 0, 4, 0
` position camera x#, 2, z#
point camera 1, 2, 0
idd=pick object(mousex(),mousey(),startid,lastid)>0
` rotate object 1000, 0, object angle y( 1000 ) + 0.3, 0
d#=get pick distance()
` fire an object when the space key is pressed
pick screen mousex(), mousey(), d#
xx1# = camera position x()
yy1# = camera position y()
zz1# = camera position z()
xx2# = get pick vector x()
yy2# = get pick vector y()
zz2# = get pick vector z()
position object 10,xx1#,yy1#,zz1#
point object 10,xx2#,yy2#,zz2#
move object 10,10
if spacekey ( ) and delay > 7
` make a sphere, colour it and position it at the location of the camera
make object sphere ID, 0.3
phy make rigid body dynamic sphere ID
color object ID, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
position object ID,xx1#,yy1#,zz1#
point object ID,xx2#,yy2#,zz2#
move object ID,5
set object to camera orientation ID
move object ID,1
` create a rigid body sphere to represent the sphere
power=1
force# = 1000 * Power
ccx#=camera position x()
ccy#=camera position y()
ccz#=camera position z()
set vector3 1,object position x(ID)-ccx#,object position y(ID)-ccy#,object position z(ID)-ccz#
`set vector3 1,object position x(ID)-xx1#,object position y(ID)-yy1#,object position z(ID)-zz1#
normalize vector3 1,1
move object ID,-1
`phy make rigid body dynamic sphere ID
`point object ID,xx2#,yy2#,zz2#
` set the velocity of the sphere to fire upwards and into the scene
phy add rigid body force ID,x vector3(1)*force#,y vector3(1)*force#,y vector3(1)*force#,3
` phy set rigid body linear velocity ID, 0, 7, 30
` phy set rigid body mass ID, 200
` phy set rigid body mass ID, 100000
`phy set rigid body linear damping ID,1
` reset the delay counter
delay = 0
` increment the ID variable
inc ID
endif
` increment the delay, this is used to have a small delay in between firing
inc delay
ff=screen fps()
mytext$="cam pos xx1#="+str$(xx1#)+" yy1#="+str$(yy1#)+" zz1#="+str$(zz1#)
mytexta$="vectors xx2#="+str$(xx2#)+" yy2#="+str$(yy2#)+" zz2#="+str$(zz2#)
mytextb$=" ff="+str$(ff)
center text screen width()/2,5,mytext$
center text screen width()/2,5+13,mytexta$
center text screen width()/2,5+13+13,mytextb$
center text screen width()/2,5+(13*3),str$(idd)
` update the physics
phy update
` now update the screen
sync
loop
DELETE MEMBLOCK 1
Dark Physics makes any hot drink go cold.