Hi, im tryin to get the code for simple matrix collisions to work. I want to make a ball follow the terrain but instead of rolling smoothly over the ground the ball jumps around randomly.
p.s i.m using DBP and a snippet from this board.
heres the code
[/code]
rem setup
sync on
rem fogging
fog on
fog color RGB(0,0,160)
fog distance 5000
load image "desert.bmp",1
make matrix 1,10000,10000,100,100
prepare matrix texture 1,1,1,1
randomize matrix 1,100
update matrix 1
position matrix 1,0,0,0
rem make sphere
make object sphere 1,30
color object 1,RGB(0,255,0)
position object 1,5000,100,5000
position camera 5000,500,5000
set camera range 1,7000
rem prog loop
do
if upkey()=1 then move camera 10 : move object 1,1
if downkey()=1 then move camera -10 : move object 1,-1
if leftkey()=1 then turn camera left 1 :move object left 1,5
if rightkey()=1 then turn camera right 1 : move object right 1,5
if shiftkey()=1 then pitch camera up 0.5
if controlkey()=1 then pitch camera down 0.5
rem simple matrix collision
height#=get ground height(1,object position x(1),object position z(1))
if object position y (1)<height# then position object (1),object position x(1),height#,object position z(1)
print camera position z()
print camera position y()
print camera position x()
sync
loop
wait key
[code]
thx
Zeno
Corruptisma republica plurages leges