For my next Dark GDK update (thread
here), too be uploaded soon. I have added ODE Physics, based on the source from DBPro version 7.4, as a starting point. I have added some functions and corrected and modified others. I plan to upload various source projects demonstrating ODE Physics and some other new functions. I also have a demo of a little pool game; I’m working on (see attachment). Everything is working beautifully; the balls roll and bounce just as they should. However, there seems to be no linearity to the force applied. I thought maybe my scale is too small. I wrote this in DBPro on a larger scale to see if this could be the problem. Run the code with the force set at 0.05 and note how far the ball moves. Now, set the force to 0.025, this seems to be linear. But, if you set the force at 0.0375 it seems to impart less momentum then when set at 0.025.
What’s up!
disable escapekey
sync on
sync rate 60
backdrop on
color backdrop 0
autocam off
position camera 0, 250, 0
point camera 0, 2.5, 0
ode start
ode set world step 0.05
ode set world erp 0.875
ode set world cfm 0.000025
ode set world gravity 0.0, -9.81, 0.0
makeBalls()
makeTable()
do
ode update
if (spacekey() and spcflag=0)
spcflag = 1
ode add force 16, 0, 0, 0.05, 0, 0, -1.125
endif
if (escapekey())
exit
endif
sync
loop
ode end
end
function makeBalls()
make object sphere 16, 5, 8, 8
position object 16, 0, 2.5, -90
ode create dynamic sphere 16
ode set contact fdir1 16, 0.2
ode set body mass 16, 0.125
endfunction
function makeTable()
make object box 17, 135, 5, 270
color object 17, rgb(0, 40, 0)
position object 17, 0, -2.5, 0
set object cull 17, 1
make object box 18, 135, 5, 5
color object 18, rgb(80, 40, 0)
position object 18, 0, 2.5, 132.2
set object cull 18, 1
make object box 19, 135, 5, 5
color object 19, rgb(80, 40, 0)
position object 19, 0, 2.5, -132.2
set object cull 19, 1
make object box 20, 5, 5, 260
color object 20, rgb(80, 40, 0)
position object 20, -65, 2.5, 0
set object cull 20, 1
make object box 21, 5, 5, 260
color object 21, rgb(80, 40, 0)
position object 21, 65, 2.5, 0
set object cull 21, 1
for i=17 to 21
ode create static box i
next i
endfunction