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 / collision... i hate it

Author
Message
Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 18th May 2006 01:12
I have been trying so many ways for collision, and I have had just about had enough. Here's what I've gotten to:

I've looked at toutorials, code snippets, everything... and I just don't understand how to do this. All I need in my code is something to make the camera and object not go through the wall. If you can help in anyway, that would be great.

Bio Fox...four guys, one computer, games like nobody's business.
Bahamut
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Brighton
Posted: 18th May 2006 01:21
Why do you end the program when the player hits the cube? If it's as a test to see if the collision is detected, use variables and print to screen. It's much clearer to see what's going on.
I'll have a look at this, but I can't make any promises. I've done collision before, but never in 1st person.

IceBound -No, really-We're quite good.
Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 18th May 2006 01:34
Sorry about the ends, yeah they were just tests. I found it easier to put that in quickly than spend the extra minute with variables. I've actually found that most people show collision in 3rd person, which is why i'm having trouble. Thanks for looking.

Bio Fox...four guys, one computer, games like nobody's business.
Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 18th May 2006 01:56
firstly, it appears that you have some unreachable code in your code above, as in certain parts of your code will never execute
secondly , I recomend that you try one of the following :
a) use static collision boxes - there is a nice example you can load that is already on your hard-drive - just search the online help for "make static colison box"
b) coding so that your object/camera wont go past a certain x,y,or z -> (you can use object x() , object y() or object z() for this ) alternatly , you can also get the camera x,y,or z using simular commands.


I also strongly recomend that you turn global colision off as this activates colision for all objects created, which in turn will slow your program down. if you must use colision detection that is provided note that there are commands that you can use that can turn colision on for just the objects that you need to use.

Bluestar4~
[href]http://www.geocities.com/bluestar4games[href]
Bahamut
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Brighton
Posted: 18th May 2006 01:57 Edited at: 18th May 2006 01:58
I'll try to look at it properly tomorrow, it's midnight here, and I want some sleep. I'm not the most experienced programmer by a longshot but I've done this before a few times, so I should come up with an answer tomorrow.

Oh, and I don't really like the way you programmed the players position. I would have positioned the camera according to the cubes position, not the other way around. Then it works like 3rd person.

Oh, and I used static objects. I think you can't alter static objects once they're made though.

I hope you get it fixed

IceBound -No, really-We're quite good.
Bluestar4
19
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 18th May 2006 02:07
hope my post above was helpful to you

Dr Manette
19
Years of Service
User Offline
Joined: 17th Jan 2006
Location: BioFox Games hq
Posted: 18th May 2006 03:19
I've worked out this new code:

I know it is basically taken from the example, minus some things, but it works! Now, all I have to do is put it in my game. Thanks to everyone that helped me.

Bio Fox...four guys, one computer, games like nobody's business.
Relativity
20
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 20th May 2006 17:13
Try using Sparky's DLL. You'll need to download the DLL (get that here: http://forum.thegamecreators.com/?m=forum_view&t=31051&b=5.

An example using Sparky's DLL for collision can be found here: http://darkbasic.thegamecreators.com/?m=codebase_view&i=d71183f50e9a2d3d7dcec986ff7dbd76.

Login to post a reply

Server time is: 2025-05-25 04:23:23
Your offset time is: 2025-05-25 04:23:23