Collision detection with polygons.

Started by
5 comments, last by obj63 20 years, 8 months ago
after looking through nehe''s tutorials and learning a ton on opengl, I want to know how I can detect a collision of my character (the translate location), and the walls of a 3d world. I am bassing this collision detection to go with nehe''s 10th tutorial. I want my character to not move past the walls like in most first person shooters, I also need help on how I can make other things not go past the walls like other characters I am looking at, at first they will be 2d but soon to be 3d. thanks for all help I truely appreciate it joe
Advertisement
www.gametutorials.com

| - Project-X - On hold.. - | - adDeath - | - email me - |
thanks I actually found theirs yesterday, I am looking at them and they look great, but in the code I understand what they are doing but I don''t understand why. I know the math find dot product, normalize, cross product ... but why is it done and how does that help check the collision. Are there any other tutorials out there that explain more

thanks
If you want something better, Google for Fluid Studios and look around on their web site. They have two CD tuts out one with source code (software rendered) and one with no source code.
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
That question is more complex than you might think. Here is what each action does in a nutshell by definition. Taking the cross product of two vectors which are the sides of polygons will return a vector that is perpendicular to both, and since it is impossible on a plane to return a vector perpendicular to two non-parallel vectors, the result is the normal to the polygon's plane in three dimensions. This normal will be used to calculate the shortest distance between the vector of the camera (same thing as its position really) and the vector collection that is the polygon. The dot product, by definition, returns the shortest distance of two vectors along the normal of one of them (its not really necessary to know which one). We take the dot product of the polygon's plane equation in ax+by+cz+d form and the camera's position (both in three dimensions obviously) to find the shortest distance between the two. Collision detection is merely checking to see if the dot product of the two previously mentioned objects is a certain value or below. Did that make any more sense? You may have to do some serious sleuthing to find an answer more exact than that. Most of the sites I went to when I was first learning collision detection were insanely confusing, so I eventually found the answers in a calculus textbook towards the back =(. Anyways good luck with your search.

[edited by - uber_n00b on August 13, 2003 3:42:40 PM]
My fellow Americans I have just signed legislation that outlaws Russia forever. Bombing will commence in five minutes.
try this

http://photoneffect.com/coldet/



thanks uber that makes perfect sense. I just had no idea why they where taking the cross, and dot products and other things. They just said do this then do that and then if this collision, but they never said why I think more tutorials need to look into this because if you teach a person what to do that is a good step, but they have to know why first, cause if they don''t know why they won''t be able to adapt it to other situations.

This topic is closed to new replies.

Advertisement