Collision Detection with 2 OpenGL Primitives
I am new to this fourm and relatively new to C++. I have a program that renders 2 primitives, a triangle and square. The program also lets the user move the triangle and the square follows it but when the square gets to the triangle it just overlaps it. I would like to be able to write some collision detection code that will make it so they won't overlap. If someone could help me or point me in the right direction I would greatly aprricate it.
Thanks!!!
I'm relativly new to C++ and OpenGL as well, and I have been starting to do some collision detection. It's been hard to find any actual code, but i have found a couple sites that have helped me understand the theory side of it.
General Collision Detection for Games Using Ellipsoids - This article is awesome, and has some psuedo code. it can get pretty complicated though.
Geometry Algorithm Archive - This site has a bunch of algorithms relating to geometry in both 2D and 3D.
http://www.gamedev.net/community/forums/topic.asp?topic_id=419878 - This is the topic where I asked for help. It has some useful information.
Hope this helps! I just want to let you know that 3D collision detection is WAY harder than it appears, and can really be a pain.
General Collision Detection for Games Using Ellipsoids - This article is awesome, and has some psuedo code. it can get pretty complicated though.
Geometry Algorithm Archive - This site has a bunch of algorithms relating to geometry in both 2D and 3D.
http://www.gamedev.net/community/forums/topic.asp?topic_id=419878 - This is the topic where I asked for help. It has some useful information.
Hope this helps! I just want to let you know that 3D collision detection is WAY harder than it appears, and can really be a pain.
2D or 3D, it's generally quite similar. as for ways to do collision detection with 2D convex polygons...
http://members.gamedev.net/oliii/satpost/DXInputs.cpp
http://members.gamedev.net/oliii/satpost/DXInputs.h
http://members.gamedev.net/oliii/PolyColly3.zip
http://members.gamedev.net/oliii/PolyColly4.zip
http://members.gamedev.net/oliii/sweptsphere.zip
http://members.gamedev.net/oliii/satpost/3DBoxPolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/3DDDA.cpp
http://members.gamedev.net/oliii/satpost/3DSpherePolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxCollision2.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxIntersect.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxMTD.cpp
http://members.gamedev.net/oliii/satpost/ConvexPolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/OrientatedBoxesCollision.cpp
http://members.gamedev.net/oliii/satpost/SpherePolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/verletparticlecollision.zip
http://uk.geocities.com/olivier_rebellion/Cube3D.zip
http://www.gamedev.net/community/forums/topic.asp?topic_id=346956
There is a bit of everything (copy and paste), but the titles should say it all. Have a look at the last link for an attempt at explaining how 2D polygon collision works. First two links are for input controls (can;t remember, but I think some examples use it).
http://members.gamedev.net/oliii/satpost/DXInputs.cpp
http://members.gamedev.net/oliii/satpost/DXInputs.h
http://members.gamedev.net/oliii/PolyColly3.zip
http://members.gamedev.net/oliii/PolyColly4.zip
http://members.gamedev.net/oliii/sweptsphere.zip
http://members.gamedev.net/oliii/satpost/3DBoxPolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/3DDDA.cpp
http://members.gamedev.net/oliii/satpost/3DSpherePolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxCollision2.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxIntersect.cpp
http://members.gamedev.net/oliii/satpost/BoxBoxMTD.cpp
http://members.gamedev.net/oliii/satpost/ConvexPolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/OrientatedBoxesCollision.cpp
http://members.gamedev.net/oliii/satpost/SpherePolygonCollision.cpp
http://members.gamedev.net/oliii/satpost/verletparticlecollision.zip
http://uk.geocities.com/olivier_rebellion/Cube3D.zip
http://www.gamedev.net/community/forums/topic.asp?topic_id=346956
There is a bit of everything (copy and paste), but the titles should say it all. Have a look at the last link for an attempt at explaining how 2D polygon collision works. First two links are for input controls (can;t remember, but I think some examples use it).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement