PDA

View Full Version : Collision Detection


creater16
2005.09.09, 02:58 AM
Hello everyone,

I am trying to do collision detection, I am thinking to do bounding box collision, however, I am not sure how to set bounding volume for my camera? Do I just Draw a box around it, for example? How do i do that?

THanks alot

unknown
2005.09.09, 09:30 AM
If you make a box around the camera position and test is for collision with other bounding boxes that will tell you if the camera is nearish a bounding box.

NYGhost
2005.09.09, 11:41 AM
For the camera using a sphere may give you smoother results and is easier to implement.

unknown
2005.09.09, 02:07 PM
Unless you wanted to detect collision with it and a box, which would be harder to implement.

NYGhost
2005.09.09, 04:47 PM
In that case you will need quite a bit of math.
the basics would be point plane intersection, and point face intersection.

this site has lots of articles about the subject
Gamasutra (http://www.gamasutra.com/)

A chapter from the book "Graphics Gems II" Ray Triangle Intersection Using Binary Recursive Subdivision help me a lot when I was trying to do CD and .

most of my collision stuff is based on this article
Advanced Character Physics (http://www.gamasutra.com/resource_guide/20030121/jacobson_01.shtml) even though the title may sound intimidating the core of all this stuff (Verlet integration scheme) is one of the easiest ways to handle stable collision detection.

sorry but there's no easy answer for your question. :\

unknown
2005.09.09, 05:00 PM
There is, use box-box collision.

hangt5
2005.09.09, 05:26 PM
The type of collision detection to use depends on a whole lot of factors:

how accurate you want it to be, how much math you can handle, how you intend to respond to the detection...etc...

What type of game are you making? is this only for the camera?

akb825
2005.09.09, 08:42 PM
How much math do you want to do? I just got done getting planes of arbitrary boundaries to collide, and here's a walkthrough of what I did. If you're interested, I can also post more specific info:

I figure that in order for 2 planes to collide, at least one boundary line of one plane must collide with the other plane. What I do is I take each bounding line of each plane and break it into a parametric equation. I plug that into the plane equation of the other plane and check the point of where it collides. A collision occurred if point is within the line's boundary (with the way I implemented it, basically if the value of t is between 0 and 1) and the point is within boundary of the other plane (basically you check the rays between the vertices and the points, add the angles between each of the consecutive rays, and if it reaches 2*pi radians (or 360°) it's inside the boundaries) With this method it is necessary to check first the one plane against the second, then the second against the first one. It's possible to speed things up by doing things such as seeing if the point is within the boundaries of the line, then only plug it into the plane equation if it is.

If you have no idea about how to do any of these things (such as create a plane equation or a parametric line equation), I suggest you either find a library that does this or just use spherical collisions. If this is only for the camera, I'd suggest just using spherical collision, but if this is for other things as well, it would probably be worth your time to work it out.