So after a few minutes fooling around with dark physics, I created a small example of dynamic falling objects. Here is the snippet!
phy start
sync on : sync rate 60
backdrop on : color backdrop rgb(0,0,0)
hide mouse
make object cube 1,1
position object 1,0,-2,5
make object sphere 2,1
position object 2,0,5,5
scale object 1,5000,200,5000
make object sphere 3,1
position object 3,rnd(20),rnd(100),rnd(20)
make object sphere 4,1
position object 4,rnd(20),rnd(100),rnd(20)
make object sphere 5,1
position object 5,rnd(20),rnd(100),rnd(20)
make object sphere 6,1
position object 6,rnd(20),rnd(100),rnd(20)
make object sphere 7,1
position object 7,rnd(20),rnd(100),rnd(20)
color object 2,rgb(rnd(255),rnd(255),rnd(255))
color object 3,rgb(rnd(255),rnd(255),rnd(255))
color object 4,rgb(rnd(255),rnd(255),rnd(255))
color object 5,rgb(rnd(255),rnd(255),rnd(255))
color object 6,rgb(rnd(255),rnd(255),rnd(255))
color object 7,rgb(rnd(255),rnd(255),rnd(255))
phy make rigid body dynamic sphere 2
phy make rigid body dynamic sphere 3
phy make rigid body dynamic sphere 4
phy make rigid body dynamic sphere 5
phy make rigid body dynamic sphere 6
phy make rigid body dynamic sphere 7
phy make rigid body static box 1
position camera 0,5,0,-5
phy set rigid body angular velocity 2,rnd(3),rnd(3),rnd(3)
phy set rigid body angular velocity 3,rnd(3),rnd(3),rnd(3)
phy set rigid body angular velocity 4,rnd(3),rnd(3),rnd(3)
phy set rigid body angular velocity 5,rnd(3),rnd(3),rnd(3)
phy set rigid body angular velocity 6,rnd(3),rnd(3),rnd(3)
phy set rigid body angular velocity 7,rnd(3),rnd(3),rnd(3)
xpos# = 0.0
ypos# = 0.0
zpos# = 0.0
facing# = 0.0
pitch# = 0.0
do
facing# = wrapvalue(facing# + mousemovex()*0.2)
pitch# = wrapvalue(pitch# + mousemovey()*0.2)
campitchtest# = wrapvalue(pitch#+180)
if campitchtest# < 90 then pitch# = 270
if campitchtest# > 270 then pitch# = 90
if keystate(17) = 1
xpos# = newxvalue(xpos#, facing#, .5)
zpos# = newzvalue(zpos#, facing#, .5)
endif
if keystate(31) = 1
xpos# = newxvalue(xpos#, wrapvalue(facing#+180), .5)
zpos# = newzvalue(zpos#, wrapvalue(facing#+180), .5)
endif
if keystate(30) = 1
xpos# = newxvalue(xpos#, wrapvalue(facing#-90), .5)
zpos# = newzvalue(zpos#, wrapvalue(facing#-90), .5)
endif
if keystate(32) = 1
xpos# = newxvalue(xpos#, wrapvalue(facing#+90), .5)
zpos# = newzvalue(zpos#, wrapvalue(facing#+90), .5)
endif
yrotate camera facing#
xrotate camera pitch#
position camera xpos#, ypos#, zpos#
phy update
sync
loop
For those here who do not have Dark Physics can download the attached exe compiled using this code.
YES, YOU CAN USE THIS CAMERA CODE IN YOUR OWN PROJECTS IF YOU WANT TO.