Ok, now that TGC made DarkPhysics available on github. Object Hit and Object Collision seem to work. Hopefully this will work the same with DarkDynamics. Source with executable attached.
#constant MaxObjects 10
type t_ObjCollData
Objb as integer
ObjSnd as integer
endtype
dim ObjCollData(MaxObjects-1) as t_ObjCollData
randomize timer()
disable escapekey
sync on
sync rate 0
backdrop on
color backdrop 0
autocam off
position camera 0, 250, 0
point camera 0, 2.5, 0
load sound "hit.wav", 1
make object box MaxObjects+1, 250, 5, 250
color object MaxObjects+1, rgb(0, 40, 0)
position object MaxObjects+1, 0, -2.5, 0
for i=1 to MaxObjects
if (i=1)
make object cube i, 5
else
clone object i, 1
clone sound i, 1
endif
position object i, rnd(200)-100, 200.0+rnd(100), rnd(200)-100
ObjCollData(i-1).Objb = 0
ObjCollData(i-1).ObjSnd = i
next i
phy start
phy set gravity 0.0, -9.8, 0.0
phy make rigid body static box MaxObjects+1
for i=1 to MaxObjects
phy make rigid body dynamic box i
next i
do
if (escapekey())
exit
endif
for a=1 to MaxObjects
b = object hit(a, 0)
if (b)
if (ObjCollData(a-1).Objb=0)
play sound ObjCollData(a-1).ObjSnd
ObjCollData(a-1).Objb = b
endif
else
ObjCollData(a-1).Objb = 0
endif
next i
while (phy get collision data())
`Pop collision data from stack. Possible memory leak.
endwhile
phy update
sync
loop
phy end