Hi, So i am trying to make a racing game. I have found a code/website (http://www.gamedev.net/reference/articles/article735.asp)that explains collision detection. However i cannot figure out how to implement this in my code. If anyone could help me to do this i would be very grateful. If you need me to post my code i will but its quite long.

Recommended Answers

All 3 Replies

To start things off, why not you post some logics about the code that you have implemented?

What programming language are you intending to use? decide then post in the forum for that programming language.

Hey, bounding-boxes is most simple collision detection method. What you didn't understood in that gamedev code exactly ?

Ok. If you want even MORE simple collision detection you can use this-
circle-circle collision method. Collision will be when: d <= r1 + r2 , here
d -> distance between circles centers.
r1, r2 - radius of first, and second circles respectively.
Assuming that you have images square-like, collision condition can be written as ((x1-x2)^2 + (y1-y2)^2)^0.5 <= 1/2*(Width1+Width2) here x1,x2,y1,y2 - coordinates of image centers.
Width1, Width2 - Width (or height) of those two square images.
Even when you have rectangles with edges approximatelly equal- you can still use this collision detection method, by setting Width1,Width constants to bigger rectangle edge, or something like (edge1+edge2)/2. So at first you can try this. When required you can switch to bounding boxes method.

Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.