Are you trying to make it so that when you hit the spacekey the gravity will begin. Well, one problem is that when you hit the spacekey it sets the variable grav# to -9.81 but then never does anything with that variable.
Thank you for using functions by the way. This code works for me if it is what you wanted to do. I don't know if it is the best way to do this but it is the only way I know.
Sync on
sync rate 0
set display mode 800,600,32
grav#=-9.81
setupODE(grav#)
make object box 1,20,20,20
position object 1,0,50,0
ODEDynamicbox(1,5,4)
make object box 2,300,20,300
ODEstaticbox(2,5,4)
ode set gravity 1,0
DO
if spacekey()=1
ode destroy object 1
ODEDynamicbox(1,5,4)
ode set gravity 1,1
endif
ode update
SYNC
loop
function SetupODE(gravity#)
ode start
ode set world gravity 0.0,gravity#,0.0
ode set world step 0.07
ode set world erp (0.2)*2.5
ode set world cfm (10^-5)*2.5
endfunction
function ODEDynamicbox(object,fric,mass)
ode create dynamic box object
ode set contact fdir1 object,fric
bodymass#=object size(object)+object size(object)+mass/30
ode set body mass object,bodymass#
endfunction
function ODEStaticbox(object,fric,mass)
ode create static box object
ode set contact fdir1 object,fric
bodymass#=object size(object)+object size(object)+mass/30
ode set body mass object,bodymass#
endfunction
Insanity is just a state of mind