Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

erroneus

Collision Detection help

This topic is 6418 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Nehe, me and many other programmers would greatly appreciate it if you or someone else you know would write a tutorial on collision detection in 3d space with opengl specification. I think it should be mostly based on tutorial 10. This would help out many opengl programmers.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try going to www.flipcode.com, www.gamedev.net, www.gamasutra.com or www.google.com. There are many, many resources out there on collision detection, if you can''t get it up and running with them you shouldn''t be trying to do collision detection in the first place.

Share this post


Link to post
Share on other sites
Try looking specifically for the following equations:

Line/plane intersection
Point in plane
Point in triangle

Basically, you would first determine if a vector from the camera position to another point, say 0, (camera height, 0) is within a plane. If it is test the point where the vector crosses the plane and determine if it is inside a particular triangle. If so, find the distance between the camera and that point. If it is less than a particular value, say .5, 1, 0, or whatever works good for you, then a collision has occured, and don''t let the camera move.

People will probably come in here and tell you things like bounding sphere, box, etc, that the above way is too slow. You can check these out too, but I''m not sure if they are really necessary. Check those out if you want to, they are easier to implement. (Find the radius of an object, check distance between camera and objects center, if it is less than object''s radius, collision has occured.) With the correct data structures (trees, etc.) you should be able to take a scene with thousands of polygons and check for collisions in real time. I''ve done it, and I bet you can too with a little work.

That should help you out until NeHe gets that tutorial up (I believe I read something about such a tutorial on the site a day or two ago.)
Ben

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Take a look at this site "www.peroxide.dk"
There is a great tutorial there about collision detection
using ellipsoids.

Share this post


Link to post
Share on other sites
Oglman: that is a very good modification to tutorial 10, I don''t know why nehe hasn''t posted it yet I''m planning on starting a programming company, nothing big, just mostly web based. Later I would sell the programs that the people in the group make and everyone will receive their share of the money. If you are interested, please email me at scottgl@juno.com

ps: To all the other people who have posted under this topic. I have already written the collision detection code. Which, when a key is pressed, saves the old camera position, and moves the camera, then saves the new camera position. It then finds the normals of the polygons (detected at startup and saved). I use a few equations, inputing one of the camera positions in each equation. If the equations are opposite, one is positive and one is negative, then you have collided, that is the basic concept. I have pinpointed my error already. It was a c++ syntax problem which the subroutine for collision detection was acidentally defined twice and so it did nothing when it was called. Just wanted to clear that up

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!