Here is some basic code to demonstrate collision using DBP commands:
` basic collision using DBP's coll. LBFN 5/27/09
sync on
sync rate 60
color backdrop 0
autocam on
hide mouse
make object cube 1,20
position object 1,100.0,10.0,100.0
color object 1,rgb(255,0,0)
make object sphere 2,10
position object 2,0.0,5.0,0.0
color object 2,rgb(0,0,255)
make object box 3,1000,10,1000
position object 3,250.0,-5.0,-250.0
color object 3,rgb(0,255,0)
speed# = 2.5
do
` get previous position
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
if upkey() = 1 then move object 2,speed#
if rightkey() = 1
y# = object angle y(2)
y# = wrapvalue(y# + 1.0)
yrotate object 2,y#
endif
if leftkey() = 1
y# = object angle y(2)
y# = wrapvalue(y# - 1.0)
yrotate object 2,y#
endif
if downkey() = 1 then move object 2,(0.0 - speed#)
if object collision(1,2) = 1
position object 2,oldx#,oldy#,oldz#
endif
x# = object position x(2)
y# = object position y(2)
z# = object position z(2)
set camera to object orientation 2
position camera x#,y#,z#
move camera -200
move camera up 100
point camera x#,y#,z#
sync
loop
end
LB