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.

DarkBASIC Discussion / Help with collision

Author
Message
TheWhite
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location:
Posted: 8th Jul 2003 09:28
I am trying to make a 3d-asteroids game the only major problem I have is how to get object collision to work.
I have used a sphere to get camera collision with my walls/asteroids with the folowing code:

For x = 1 to 6 (the walls)
if object collision (x,7) > 0
code to get camera back to where it is supposed to be
endif
next x
For x = 10 to 16 (the asteroids)
if object collision (x,7) > 0
code to get camera back to where it is supposed to be
endif
next x

and this by itself works fine. The problem comes when I try to get a bullet to hit an asteroid. I have used the following
For x = 10 to 16 (the asteroids)
If object collision (x,9) > 0 (have also tryed 9,x)
do stuff
Endif
Next x

What happens now is that neither the bullet nor the camera object will hit the asteroids unless BOTH of them are hitting at once in which case only the bullet part of the code will work.
Can anyone help me pls
Porl
21
Years of Service
User Offline
Joined: 28th May 2003
Location: United Kingdom
Posted: 8th Jul 2003 13:23
Have you set up the collision boxes for the objects? ... i.e. make object collision (object number),-10,-10,-10,10,10,10
that would make an object collision box 20 across, high and long. . . .

thats how i do collision. Whatever objects are going to collide with something else needs a collision box / area....



Porl''
Porl
21
Years of Service
User Offline
Joined: 28th May 2003
Location: United Kingdom
Posted: 8th Jul 2003 13:26
sorry...the function goes : Make object collision box (object number),-10,-10,-10,10,10,10,0 you seem to need the 0 at the end of the co-ords.. ..dont know why...

Porl''
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 8th Jul 2003 18:20
it`s a flag and has the value 0 or 1, 0 means return slide collision data and 1 provides "no slide" collision data but allows you to rotate the box to angles other than 0,90,180,270, so you can make more natural looking levels but you lose the slide collision, I hear a rumor we get slide collision for rotated stuff in patch 5 or maybe 6 (but it is a rumor...may be nothing to it), cheers.

Mentor.

TheWhite
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location:
Posted: 9th Jul 2003 02:53
Thanks, I'll try that.

Login to post a reply

Server time is: 2025-05-20 02:01:14
Your offset time is: 2025-05-20 02:01:14