# Collision Detection

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

## Recommended Posts

Hi Do anyone know a good tutorial or can help me right here! I want to do a Collision Detection test between a Circle and Rectangle (that isnt rotated). It dont have to take care of edges I just want to have a simple one. The big problem is that both is moving so I dont know how do it. The thing I need to know is only which side the ball collided with in the rectangle. this is the variables: xBall, yBall, BallRadius, xBallVel, yBallVel xRect, yRect, RectHalfWidth, RectHalfHeight, xRectVel, yRectVel. Is it possible to do such a test in one step??? plz plz help!

##### Share on other sites
Source code for finding the first time of contact and the contact point between a moving circle and an oriented rectangle are at (http://www.magic-software.com), the Source Code tab, then the Intersection tab, files WmlIntrCir2Box2.{h,cpp} (and various supporting files). I also have an application to illustrate this. From the Source Code page, select Applications, Application Types: Miscellaneous, then "Dynamic intersection of a moving circle and a rectangle". Computing the first time/point of contact is trickier than you might think.

##### Share on other sites
This tutorial is in flash, and the theory is very good, check it out:

Collision Detection

##### Share on other sites
Ok i think ive a plan how to do this!
But I must ask only this Iam doing a kind of pong style game.
My idea is to "stop" the ball when it hits something so I dont have to do all tests once more in that frame.

this is for example the check if the ball hits the bottom.

{
Direction = -Direction;
}

It works but I thought this should make it quite smooth, well it is if the balls move in about 20 pixels per second.
Is it an unsmooth technique or is the formula wrong?
Or do anyone have better ideas??
Plz HElp

##### Share on other sites
Quote:
 Original post by J_VitelThis tutorial is in flash, and the theory is very good, check it out: Collision Detection

Very nice tut J_Vitel.

1. 1
2. 2
3. 3
4. 4
5. 5

• 14
• 9
• 10
• 12
• 17
• ### Forum Statistics

• Total Topics
632909
• Total Posts
3009171
• ### Who's Online (See full list)

There are no registered users currently online

×