Working on another example, but have encountered a problem.
As you can see from the screenshot, the objects stop moving once they're done interacting with each other. Anyone else have this problem? I want to ensure that gravity works on all objects even once they're done moving so they can move again.
Sorry if that sounds kind of confusing, not sure how to explain, but take a look at the source.
The Source Code(A bit messy, but will be cleaned up later)
Set display mode 1024,768,32
Sync on : sync rate 60
autocam off
ode start ` Start ODE
ode set world gravity 0,-20,0 `Set the direction and strength of gravity
ode set world step 0.05
ODE SET WORLD QUICK STEP NUM ITERATIONS 2
ode set world erp (0.2)*2.5 ` See documentation
ode set world cfm (10^-5)*2.5 ` See documentation
cls rgb(255,0,0)
get image 1,1,1,32,32
cls rgb(0,255,0)
get image 2,1,1,32,32
cls rgb(0,0,255)
get image 3,1,1,32,32
_Tiles = 40
_Objects = (_Tiles*_Tiles)
dim Grid(_Tiles,_Tiles)
dim Grid1D(_Objects)
object=1
For x = 1 to _Tiles
For y = 1 to _Tiles
Grid(x,y)=rnd(1)+1
Grid1D(Object)=Grid(x,y)
make object box object,14,14,14
if Grid1D(Object)=1 then delete object object`ghost object on object
if object exist(object)
texture object object,Grid(x,y)
position object object,x*14,y*14,0
ode create static box object
ode set contact fdir1 object, 25.0
ode set response object,0
endif
inc object , 1
Next x
Next y
for x = _Objects+2 to _Objects+40
make object sphere x,7
position object x,rnd(_Tiles*14),(_Tiles*14)+10,0
ode create dynamic sphere x
ode set contact fdir1 x, 10.0
ODE SET BODY MASS x, 21.0
ODE SET GRAVITY x, 1
ODE SETSURFACE MODE CONTACT SLIP1 x, 1
next x
position camera 280,560,-500
disable escapekey
Do
`Interface
center text screen width()*0.5,20,"Arrowkeys to move | left mouseclick to delete blocks"
x#=camera position x()
y#=camera position y()
z#=camera position z()
`[=========Camera==========]
if upkey()=1
position camera x#,y#+1,z#
endif
if downkey()=1
position camera x#,y#-1,z#
endif
if leftkey()=1
position camera x#-1,y#,z#
endif
if rightkey()=1
position camera x#+1,y#,z#
endif
`[=========Camera==========]
p=pick object(mousex(),mousey(),1,_Objects)
if mouseclick()=1 and p<>0
if object exist(p)
delete object p
ODE DESTROY OBJECT p
endif
endif
if escapekey()=1
flush video memory
ode end
end
endif
ode update ` Update ODE physics
Sync
Loop
A book? I hate book. Book is stupid.
(Formerly Yellow)