Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / collison problem

Author
Message
Zeno
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location:
Posted: 21st Mar 2005 07:10
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
Dark Flame
19
Years of Service
User Offline
Joined: 15th Feb 2005
Location: England
Posted: 21st Mar 2005 07:45
Sounds like a great idea...BUT i dont know how to do that. So you'll just have to see what people put.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 21st Mar 2005 23:48
Quote: "if object position y (1)<height# then position object (1),object position x(1),height#,object position z(1)"

Try this instead...
Quote: "Position object 1,object position x(1),height#,object position z(1)"


"Droids don't rip your arms off when they lose." -H. Solo

REALITY II

Login to post a reply

Server time is: 2024-11-13 20:02:06
Your offset time is: 2024-11-13 20:02:06