Collisions in 3D

Post Reply
Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Collisions in 3D

Post by Sylus101 » Sun Nov 08, 2009 10:50 am

Okay... so I've worked with 2D collisions quite a bit, and I'm wondering what are the most commonly used methods for collision in 3D? Can you apply the rectangular and circular collision concepts to a rectangular cube or sphere?

My guess... for reasonable dirty collisions I would do the best I could to define rectangular dimensions around an object and run greater than/less than boundary tests... does that sound about right?

I'm currently researching the model matrix and how to determine the new location of a vertex after it's been translated, rotated or scaled... I'm gathering I can use glGetFixed() and retrieve the GL_GET_MATRIX_POSITION to run some tests?
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Dark Dude
Posts: 6
Joined: Wed Nov 04, 2009 12:56 am

Re: Collisions in 3D

Post by Dark Dude » Sun Nov 08, 2009 11:13 pm

When I did OpenGL 3D for Win32, I drew all my models' vertices as offsets from a central point. From there, I gauged a sphere around the model itself using a presumed radius, and every time the physics engine updated, I looped through all the models comparing them to each other, in which I had some trig in way to calculate the distance between the two central points of the comparing models, and then I added together their radii and checked if it matched/was smaller (and thus collided) than the distance :P

A very quick and dirty method indeed. Can kill your framerate if the scene is big enough, but very easy to deploy, and not unlike that of the 2D one either ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests