I`v moded your code, just to help a beginner.
`sorry if none of this is what you wonted to know but I had time to kill
`it was this or play on my xbox360, and I could not face yet another game of halo3
autocam off
sync on
Sync Rate 60 :`change to your sync rate of 0
hide mouse
`Gravity = 1
Elapsed# = Timer() - OldTime
OldTime = Timer()
phy start
` change object material, this just an exampale of how this can be used
` its a bit of a boj
phy make material 1,"object material"
phy set rigid body mass 1,0.5
phy set material dynamic friction 1,0.5
phy set material static friction 1,0.5
phy set material restitution 1,0.5
phy build material 1
`this object will have the mest up material
`player object
make object cube 1, 10 :` I`v changed this to stop you from rolling off
color object 1,rgb(255,0,0)
Position Object 1, 0, -10, 0
phy make rigid body dynamic box 1 :` I`v changed this to stop you from rolling off
phy set rigid body mass 1, 10000
`ball object
Make Object sphere 2, 12
color object 2,rgb(0,0,255)
Position Object 2, 0, -10, 25,
Phy Make rigid body dynamic sphere 2,1 :` I`v added my material to this physic object
Phy Set rigid body mass 2, 9000
`load object "MapsLvl1.dbo", 3 :` and replace this line by deleteing (`)
make object cube 3,1 : ` put the word rem befor this line to remove it from being read by dbpro
scale object 3,10000,10,10000 :` or like with this line you could just delete it
Position Object 3, 0, -100, -0
`phy make rigid body static mesh 3
phy make rigid body static box 3 :` just remove this and replace the code above for you map
`Set Shadow Shading On 1
DO
phy update
` this just prints output to the screen
set cursor 0,0 : print "press return key re-set sim"
` I`v add this be cos it is hady as hell, and you can use it with the space key gravity change
` this will also alow you to reset your sim
if returnkey()=1
`player object exists and delete
if phy get rigid body exist(1)=1 then phy delete rigid body 1 :` if your going to delete something it is a good thing to keep the exist statements in mind
if object exist(1)=1 then delete object 1 :` and it works for a lot of thing
`ball object exists and delete
if phy get rigid body exist(2)=1 then phy delete rigid body 2
if object exist(2)=1 then delete object 2
`player object
if object exist(1)=0 and phy get rigid body exist(1)=0
make object cube 1, 10
color object 1,rgb(255,0,0)
Position Object 1, 0, -10, 0
phy make rigid body dynamic box 1,1
phy set rigid body mass 1, 10000
endif
`ball object
if object exist(2)=0 and phy get rigid body exist(2)=0
Make Object sphere 2, 12
color object 2,rgb(0,0,255)
Position Object 2, 0, -10, 25,
Phy Make rigid body dynamic sphere 2
Phy Set rigid body mass 2, 9000
endif
endif
gosub Controlls
gosub Camera
`if Gravity = 1
`Phy set rigid body gravity 1, -9.8
`Phy Set rigid body gravity 2, -9.8
`endif
set cursor 0,20 : print "hold space key to change gravity"
` I`v added this so you can see what speed you fall at
if spacekey()=1
phy set gravity 0,-0.1,0
else
phy set gravity 0,-9.8,0
endif
sync
LOOP
` I don`t know why I`v added this but it wont hert it
phy end
end
Controlls:
`just a note on your player controls, you sould have a go at CHARACTER CONTROLLER and see what you make of them
if object exist(1)=1 and phy get rigid body exist(1)=1 :` I`v add this so you dont get an error when you delete objects and physic
if upkey()=1
Phy Set rigid body position 1, Object Position X(1), Object Position Y(1), object position z(1)+0.4 :` I`v changed the value 0.04 in to 0.4 just to speed thing up
endif
if downkey()=1
Phy Set rigid body position 1, Object Position X(1), Object Position Y(1), object position z(1)-0.4
endif
if leftkey()=1
Phy Set rigid body position 1, Object Position X(1)-0.4, Object Position Y(1), object position z(1)
endif
if rightkey()=1
Phy Set rigid body position 1, Object Position X(1)+0.4, Object Position Y(1), object position z(1)
endif
endif
return
Camera:
if object exist(1)=1 and phy get rigid body exist(1)=1 :` I`v add this so you dont get an error when you delete objects and physic
Position Camera Object Position X(1), Object Position Y(1)+100, Object Position Z(1)-40
Point Camera Object Position X(1), Object Position Y(1), Object Position Z(1)
endif
return
soul sucking devils, twisted body of the damed, slivering slim drips from every poor, sin licking at your ears, and the smell stinging your eyes, and if you don't like it, get out of my kitchen!