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 / This collision is doing my head in

Author
Message
Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 15:27
I made a quick test collision program in DB to see if it was my fault but it worked, but I cant work out why this code is not working. Its doing my head in. All I want at this stage is the collision to print something on screen. Here is the full code of my program

rem world creation
sync on
hide mouse
Randomize timer()
Set global collision on



set text to bold : Set text font "arial" : Set text size 16

REMSTART
Pretty much a joke loading screen
Although it does need a few seconds to load without it
REMEND

sync : center text screen width()/2,screen height()/2,"LOADING" : sync
wait 3000


gosub _Load_Game_Media
gosub _Setup_Game


DO

gosub _Player_Control
gosub _Hoop_Collision

sync

LOOP


_Setup_Game:

' Matrix----------------------
make matrix 1,500,3000,100,200
randomize matrix 1,3
prepare matrix texture 1,1,60,60
' -------------------------------------


' -----------------Setup the ship------------
scale object 1,2,2,2
position object 1,50,50,15
' ---------------------


' ----------------Setup the hoops------------(cubes atm)

REMSTART Cube_No generates an object number so the command "make object" can be run multiple
times with one line of code (or three) (Did it like this for the sake of practice)
REMEND

FOR Cube_No=2 to 10
make object cube Cube_No,10
Next Cube_No

FOR Obj_Pos=2 to 5
position object Obj_Pos,RND(400),RND(200),RND(2500)+50
Next Obj_Pos

' -------------------------------------------

update matrix 1

make camera 1

return


_Player_Control:

position camera 1,object position x(1),object position y(1),object position z(1)-40



if upkey() then xrotate object (1), object angle x(1)-0.4
if downkey() then xrotate object (1), object angle x(1)+0.4

if object position y(1)
Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 15:28
argh it never "snippeted" it , let me try again

Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 15:32
Argh forgot to change the matrix settings. It runs a bit slow set like that, but I was just testing it. I left it at 100,100 instead of 100,200.
(Need edit button please?)
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 9th Mar 2003 16:00
Is it because you have created 9 cubes and only checked to see if there has been a collision with one of the cubes(number 2). If that's the problem set the sub _Hoop_Collision to

but that may just be an error in your test program.

PS. Can you see my new avatar? I'm not sure if it will work with tripod.

Visit the Mad Matt Games Website
http://www.geocities.com/madmattgames/index.htm
Home of Witch Bomber and Pinball Football (and a lame website)
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 9th Mar 2003 17:20
Tripod sucks with hosting- and no we cant see it.

For collision, have one master object, object 0. Then just use

For x=1 to (however many objects you have)
if object collision(0,x)
collision code here
endif
next x

RPGamer

Current - RPG: Eternal Destiny
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy! Oh ya, and Tat has a plugin for that!
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 9th Mar 2003 19:16
I'm just using Yahoo Geocities now. You probably can't see it but I can.

Visit the Mad Matt Games Website
http://www.geocities.com/madmattgames/index.htm
Home of Witch Bomber and Pinball Football (and a lame website)
Witch Bomber
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 9th Mar 2003 19:17
It looks cool(honest)

Visit the Mad Matt Games Website
http://www.geocities.com/madmattgames/index.htm
Home of Witch Bomber and Pinball Football (and a lame website)
Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 19:28
I test collision with all the cubes to find the one im checking for collision but none of them work. But ill try both of your suggestions
Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 20:02
Ive removed all the cubes except one and made it bigger to make sure the collision cant be missed but the code still wont detect a collision. WHY!! *cries* Ive moved the command to the main loop and Ive tried everything I can think of but no result.
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 9th Mar 2003 20:36
change this:



to this:

Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 9th Mar 2003 23:28
Ive nailed what the problem is! I hope someone can help me with this though : the problem is with my object, a .x file. When I use this the collision will not work, but when I changed the object to a cube the collisions worked. is this a bug or is it just the model?
Dr BOK
21
Years of Service
User Offline
Joined: 8th Feb 2003
Location: United Kingdom
Posted: 10th Mar 2003 18:44
IT was made in Cinema 4D

Login to post a reply

Server time is: 2024-11-27 23:39:18
Your offset time is: 2024-11-27 23:39:18