Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Reply
Old 22-Jul-2004, 23:00   #1
AlStrong
penguins
 
Join Date: Feb 2004
Posts: 13,978
Default collision detection

Yeah, I know it's something a little odd to ask, but anyhoo...

I'm doing a mini program in openGL, and I want to implement collision detection between a box, 3 walls and a floor...

Anyone know of a good tutorial to implement this? The one I've found (NeHe's lesson 30 ) are somewhat specific to what those programs are doing. I was wondering if there's some general format I can follow...

AlStrong is offline   Reply With Quote
Old 22-Jul-2004, 23:07   #2
Ostsol
Senior Member
 
Join Date: Nov 2002
Location: Edmonton, Alberta, Canada
Posts: 1,765
Default

I have yet to write a collision system consisting of more than just bounding spheres and cylinders, but here's a list of articles on the subject:

http://www.gamedev.net/reference/lis...tegoryid=45#99
__________________
"Extremism is so easy. You've got your position, and that's it. It doesn't take much thought. And when you go far enough to the right, you meet the same idiots coming around from the left." -- Clint Eastwood

-Ostsol
Ostsol is offline   Reply With Quote
Old 23-Jul-2004, 16:21   #3
AlStrong
penguins
 
Join Date: Feb 2004
Posts: 13,978
Default

thanks, I'll go through those.
AlStrong is offline   Reply With Quote
Old 23-Jul-2004, 16:40   #4
Simon F
Tea maker
 
Join Date: Feb 2002
Location: In the Island of Sodor, where the steam trains lie
Posts: 4,382
Default

While on the subject of collision detection, check out the Jenga (and roadkill!) demos in this physics simulator. (Click/download Novodex rocket).

It is awesome.
__________________
"Your work is both good and original. Unfortunately the part that is good is not original and the part that is original is not good." -(attributed to) Samuel Johnson

"I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." Alan Kay
Simon F is offline   Reply With Quote
Old 23-Jul-2004, 18:01   #5
AlStrong
penguins
 
Join Date: Feb 2004
Posts: 13,978
Default

oooo.....



hm.... not understanding well, actually... see I'm just starting out, so right now I've got this cube and walls setup through GL_QUADS. I don't get how I might access the objects for use in the collision detection equations. Am I even making sense?
AlStrong is offline   Reply With Quote
Old 23-Jul-2004, 19:42   #6
Infinisearch
Junior Member
 
Join Date: Jul 2004
Location: USA
Posts: 65
Default

Think of it like this any movable object in your game world exists in four distinct 'spaces', collision, physics, geometry, and the world. The world is your objects position and orientation, the geometry is the mesh that is associated with the object, mass/inertia tensor velocity/acceleration (linear and angular) all are properties of your object in relation to the physics 'space'. When it comes to collision you have a variety of different ways to implement your object representation in that 'space'.

The choice of representation is usually a tradeoff between speed and accuracy. For example a bounding sphere is a common collision primitive, a sphere that encloses all of the object is associated with the object and is used for collision purposes. Why a sphere? because imagine testing to see if two spheres collide, if the sum of the radius's of the two spheres is greater than the distance between there centers the spheres are colliding. This can be done lightning quick. The obvious drawbacks are that spheres will give you alot of faulty collisions depending on the actually shape of said object. So look up things like sphere trees, AABB, OBB, line swept spheres, bounding volume hierarchies. There are many papers out there for you to read, as well as libraries for you to look into DEEP, SWIFT++, PIVOT, SWIFT, H-COLLIDE, RAPID, PQP, V-COLLIDE, I-COLLIDE, IMPACT.
(the previous all can be found here: http://www.cs.unc.edu/~geom/collide/packages.html) There are many more like the one thats integrated into ODE (a physics engine), i forget its name at the moment. Oh and there is a website by the name of magic-software, somewhere on there site is a table on the math of colliding various type of primitives with each other i.e. triangles and lines.

For you I would advise using a bounding sphere for the object and the plane equations for the walls and floor/ceiling (assuming they are flat). The plane equation is fast easy to understand and well documented.
Infinisearch is offline   Reply With Quote
Old 23-Jul-2004, 19:53   #7
AlStrong
penguins
 
Join Date: Feb 2004
Posts: 13,978
Default

whoa Okay, lots of reading to do, thanks


Yes, everything is flat, there's just a cube in the room which I can move or rotate in the x,y,z at the press of keys.

I was looking at the planes stuff, but it kind of flew right past me (implementation).

off to some reading, and perhaps back on monday for this thread (update).


edit: just to note.. there's a right parenthese in your link
AlStrong is offline   Reply With Quote
Old 24-Jul-2004, 22:04   #8
Infinisearch
Junior Member
 
Join Date: Jul 2004
Location: USA
Posts: 65
Default

Plane stuff is pretty simple. This is from memory just so you get the concept don't mind the memory lapses I made note of what i can't remember at the moment. The plane equation is Ax+By+Cz(-/+)D=0 so you have a four vector of floats defining your plane. The normal or the whole thing including D must be normalized (forgot which) when you plug a point into the equation, the output is zero if the point is on the plane. If not its the shortest (line perpendicular from plane to point) distance to the plane, a negative distance means its distance D away from the plane on the other side of the normal. Long story short, if you use a bounding sphere and plug the current location of the center of said sphere into the plane equation, compare distance returned with radius of sphere... which will bring you to collision response which is another topic entirely. Just remember you need to stores collisions you can't just respond to them immediately, think collision in corner with two walls at same time.
Infinisearch is offline   Reply With Quote
Old 26-Jul-2004, 15:25   #9
AlStrong
penguins
 
Join Date: Feb 2004
Posts: 13,978
Default

ah.... I think I understand it better now. Thanks

*still working on code*
AlStrong is offline   Reply With Quote
Old 29-Jul-2004, 08:16   #10
dborca
Registered
 
Join Date: Jul 2004
Posts: 8
Default

If you're a fan of Minkovsky sums, here is one fast collision detection for arbitrary polytopes. Really easy to implement/understand. Also, pseudo-code provided.

Kelvin Chung Tat Leung's thesis.
dborca is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AnandTech article up (X360 vs PS3) pipo Console Technology 87 26-Jun-2005 05:58
Opengl per pixel collision detection K.I.L.E.R 3D Technology & Algorithms 4 19-Jun-2005 23:03
UT2004, Far Cry - CPU and VPU (nv40, R420) ShePearl 3D Architectures & Chips 196 27-May-2004 09:11
Help implementing collision detection ShinHoshi General Discussion 5 21-Aug-2003 17:56
The next-generation: The camera and collision detection Ooh-videogames Console Technology 21 24-Feb-2003 02:47


All times are GMT +1. The time now is 18:02.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.