Once I delete the field "by pressing the mouse buttons" the effect disappears
` create a stack of boxes
` start the physics simulation
`phy enable debug
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 60
` 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
load image "stripe6.png", 3
make object box 1, 100, 1, 100
phy make rigid body static box 1
texture object 1, 3
ID = 10000
xpos# = -2
ypos# = 1
cubes = 5
for z = 0 to cubes
for x = 0 to cubes
for y = 0 to cubes
make object cube ID, 1
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
position object ID, xpos#, ypos#, zpos#
phy make rigid body dynamic box ID
phy sleep rigid body ID
xpos# = xpos# + 1
inc ID
next y
xpos# = -2
ypos# = ypos# + 1
next x
xpos# = -2
ypos# = 1
zpos# = zpos# + 1
next z
` turn autocam off
autocam off
` position the camera so we can view the whole scene
`position camera 0.5, 2, -4
position camera 3, 10, -20
` 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
make object sphere 500, 2
position object 500, -10, 6, 0
phy make rigid body dynamic sphere 500
phy set rigid body kinematic 500, 1
phy create force field 1
phy set force field coordinates 1, 1
phy set force field constant 1, 800.0, 2000.0, 0.0
phy set force field rigid body 1, 500
phy build force field 1
phy add force field sphere 1, 0, 0.0, 0.0, 0.0, 4
fX# = -10
fY# = 6
do
set cursor 0, 0
print "Use the arrow keys to move the sphere click left or right mouse to reverse force"
if upkey ( )
fY# = fY# + 0.1
endif
if downkey ( )
fY# = fY# - 0.1
endif
if leftkey ( )
fX# = fX# - 0.1
endif
if rightkey ( )
fX# = fX# + 0.1
endif
if mouseclick()= 1
phy delete force field 1
phy create force field 1
phy set force field coordinates 1,1
phy set force field constant 1, 1200.0, 2000.0, 0.0
phy set force field rigid body 1, 500
phy build force field 1
phy add force field sphere 1, 0,fX#, fY#,0.0, 4
endif
if mouseclick()= 2
phy delete force field 1
phy create force field 1
phy set force field coordinates 1,1
phy set force field constant 1, -1200.0, -2000.0, 0.0
phy set force field rigid body 1, 500
phy build force field 1
phy add force field sphere 1, 0, fX#, fY#,0.0, 4
endif
phy set rigid body kinematic position 500, fX#, fY#, 0
` update the physics
phy update
` now update the screen
sync
loop
It will help when a more detailed explanation of the parameters are forhcoming
Codger
System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem