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 / Object collision isn't detected

Author
Message
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 15th Apr 2005 23:11
Hi

For some reason everytime I use this command to retrieve the collision return values, I get 0 as the answer


I am desparately in need of help with this issue so any help is very much appreciated

Thanks in advance

HelloWorld Tommorrow
Underworld 1020
21
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 16th Apr 2005 00:49 Edited at: 16th Apr 2005 00:53
Well, that simply means that object 2 is not colliding with any other object. However, if you run the program and can see that object 2 really is colliding with another object, then there could be a problem with either object's collision settings.

Make sure that you've either used the Set Global Collision On command or the Set Object Collision On command.





Use either of those commands and see if it solves the problem or not, but keep in mind if you use the Set Object Collision command, then make sure you use it on object 2 and also the object you want it to collide with .

Edit: There are also other collision commands that you can use that let you specify what kind of collision you want, but try the two commands I talked about up above to see if thats the problem or not.

snicko
21
Years of Service
User Offline
Joined: 22nd Mar 2004
Location:
Posted: 9th Jul 2005 06:20
I also have a collision problem, the game ignores all collision. What should happen is object 50 should hit something, a cloud of fire should appear and mission failed shoud appear. The game is a space shooter. If anyone can see why the gun code does not work, that would be useful as well. Bullets just vanish and after about three nothing happens. I warn you i am no good at commenting or writing clean code. The magicworld level is attached.

Attachments

Login to view attachments
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 9th Jul 2005 22:20
What is wrong with the collision settings here? This is to do with the first person game I advertised for beta testers in another forum.
Also, I don't understand what al the angle part of the code means. I run this code with the rest of the program, the camera moves around fine, but still goes straight through everything! (object 56 is an invisible sphere to detect collision with the camera and a wall.)

I am a Christian and I know that God loves me. That is what makes my life so great!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Jul 2005 03:16
When I use collision, I always use collision boxes.
Maybe you can try that.

Immunity and Annihalation makes Immunihalation...
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 11th Jul 2005 18:41
I may be stupid, but "collision boxes"? I don't get it...

I am a Christian and I know that God loves me. That is what makes my life so great!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Jul 2005 23:58
Yes, you can create a collision box to an object, and it follows the given object and/or rotate with it.

I usually do it this way:



collision box object,X,Y,Z,X2,Y2,Z2,rotate_flag
object is the object that should be followed.
X,Y,Z,X2,Y2,Z2 determines the size of the collision box.
rotate_flag 0 means it won't rotate with the object, 1 says it will. I usually take 0 because you can use get object collision X/Y/Z()

In the main loop:



hope this helps

Immunity and Annihalation makes Immunihalation...
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 12th Jul 2005 01:39
Collision boxes are very unefficient for commercial games or any games that have polygonal objects. These "boxes" are invisible boxes drawm to fit the object's maximum dimensions, and then you just implement box collision for the game. This doesnt work at all with polygonal objects though since most polygonal objects aren't perfect cubes, they have parts jutting out of them. So you'll basically be running into nothing and a collision will be detected.

I recommend using intersect object if you want to do this yourself, I created a function for object intersection collision (COLD) in the WIP boards, its not finished but could workd. Then there's Kensupens and G-Man/Lost In Thought's Excellent collision handling commands in Code Snippets.

Basically, don't use box collision unless all your objects .dbo objects.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 12th Jul 2005 18:48
Quote: "
unefficient
"

*cough*hmm.

Think about it; Instead of having to check 100s, possibly thousands of polygons to see if they collide with something, you could merely work with 6. *OBVIOUSLY* you're going to lose some precision, but for something such as a bullet, box collision would be fine.

Think about the shape of a bullet - The player wouldn't notice the difference between one with properly-applied box collision, or polygon collision! The tip of the bullet hit them, hide object bulletNum, health=health-20. That's all that matters.

However, there are cases when you need more accuracy, I'll admit.


Oh yeah, and what do you mean about DBO objects?

How's my typing? Phone 0800-GO-TO-HELL
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 17th Jul 2005 22:33
Thanks for the help guys - sorry I've been away.

HelloWorld Tommorrow

Login to post a reply

Server time is: 2025-05-22 21:22:46
Your offset time is: 2025-05-22 21:22:46