I have been playing with ODE physics and encountered some rather basic problems.
Here is some code to illustrate the problem I have.
Rem Project: Dark Basic Pro Project
Rem Created: Sunday, August 29, 2010
Rem ***** Main Source File *****
set display mode 800,600,32,1
sync on: sync rate 60
begin:
gosub start
goto begin
start:
` Create the ODE World
ode start
ode set world gravity 0,-20,0
ode set world step 0.05
ode set world erp (0.2)*2.5
ode set world cfm (10^-5)*2.5
` Create a static floor. Implement in Dark Basic Professional first,
` and then ask ODE to do the same...
make object box 1,200,10,200
color object 1, rgb(128,255,128)
ode create static box 1
` Create 4 dynamic objects
` Implement in Dark Basic Professional first
` and then ask ODE to do the same...
make object box 2,10,5,8
make object sphere 3,12,16,16
make object cone 4, 10 : xrotate object 4, 90
make object box 5,8,0.1,10 : xrotate object 5, 90
position object 2, -5,20,0
position object 3, 3,40,3
position object 4, 0,60,-3
position object 5, 0,80,5
ode create dynamic box 2
ode create dynamic sphere 3
ode create dynamic triangle mesh 4
ode create dynamic box 5
` continued…
` Add friction to our objects
ode set contact fdir1 1, 20.0
ode set contact fdir1 2, 20.0
ode set contact fdir1 3, 20.0
ode set contact fdir1 4, 20.0
ode set contact fdir1 5, 20.0
` Position the camera, and watch what happens...
position camera 0, 50, -120
point camera 0,20,0
while inkey$() = ""
control camera using arrowkeys 0,3,4
ode update
sync
endwhile
ode end
for n=1 to 5
delete object n
NEXT n
return
` Tidy up...
end
The objects are falling through the static box floor for some reason I cannot fathom.
http://s6.bitefight.org/c.php?uid=103081