code from basic should get you going on what does what.
` the way forces work are dependant on which command is used and in
` this demo program we'll show the difference between applying
` global and local force to an object
` we begin by starting the physics process and setting some initial
` properties of the application, such as sync rate and camera position
phy start
autocam off
sync on
sync rate 60
color backdrop 0
position camera 0, 20, -100
rem stripe textures
load image "stripe5.png",8
make object sphere 8,400,48,48
texture object 8,8
scale object texture 8,6,6
set object cull 8,0
load image "stripe6.png",1
` a box is made to represent our floor object
make object box 1, 50, 1, 50
texture object 1,1
phy make rigid body static box 1
` a cube is created and positioned on top of the floor over to the left
make object cube 2, 5
position object 2, -10, 5, 0
phy make rigid body dynamic box 2
` another cube is created and positioned on top of the floor and over to
` the right side, the cube is rotated by -45 degrees on the Z axis
make object cube 3, 5
position object 3, 10, 5, 0
rotate object 3, 0, 0, -45
phy make rigid body dynamic box 3
` all of the objects in the scene are given a splash of colour
for i = 2 to 3
color object i, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular i, rgb ( rnd ( 255 ), rnd ( 255 ), rnd ( 255 ) )
set object specular power i, 255
set object ambient i, 0
next i
` the dark physics logo is loaded and displayed with a sprite
load image "logo.png", 100000
sprite 1, 0, 600 - 60, 100000
` now we get to our main program loop
do
set cursor 0, 0
print ""
print "Press the space bar to apply forces to the objects on the global and local Y axis"
print ""
print "Global force is applied to object 1 on the left"
print ""
print "Local force is applied to object 2 on the right"
` when the space key is pressed some force will be added to both
` cubes, one will have global force applied to it and the other
` will have local force applied to it
if spacekey ( ) = 1
` as cube 2 has not been rotated it is set up so that the X axis is
` pointing to the right of the scene, the Y axis is pointing upwards
` and the Z axis is pointing into the scene, we want to apply a
` global force onto this cube and push it up into the scene on the
` global Y axis which is pointing upwards, to do this we use the
` command phy add rigid body force as this will apply force globally,
` we pass in the object number 2, then no force on the X axis, a large
` force on the Y axis and no force on the Z axis, the final parameter
` is the force mode, we use mode 0 as we want to apply a regular force
phy add rigid body force 2, 0, 100000, 0, 0
` now we will take the other cube and apply force to it locally, this
` works by taking the current direction of the object and then applying
` the force on that axis, as we have rotated this cube the Y axis is
` not facing upwards, instead it is facing diagonally up towards the right
` of the scene, therefore when force is applied on the local Y axis
` the cube will fly off upwards and to the right
phy add rigid body local force 3, 0, 100000, 0, 0
endif
` now we update the physics simulation and the screen
phy update
sync
loop
Dark Physics makes any hot drink go cold.