1. ## Circle Collision

I am developing an air hockey game and trying to make collisions as realistic as possible. So giving the paddle which is controlled by the mouse a mass and taking into consideration the velocity of it. I have found this code but was wondering if there is a simpler way to do it? or if porting it might be the best option. Also I am using XNA 4.0

http://www.gamedev.net/topic/488102-...post&p=4187725

2. ## Re: Circle Collision

I am assuming that you have a class that represents your puck. If this is the case, then simply set it's region to it's elliptical shape. Once you have it's region set, then you will be able to check if the puck has collided with an object by calling the Region.Intersect method. Even if you aren't using a class to represent your puck and just simply drawing your puck as a Texture2d, whenever you draw the puck you could set it's region then and still use the Intersect method to check for collision. The only difference is that you'd store the region as a GraphicsPath variable.

3. ## Re: Circle Collision

I have the collision working I got per pixel collision working. Problem is the actual collision want it to be as elastic as possible so the puck moves in the right direction and speed.

4. ## Re: Circle Collision

Ah, ok I see. There was a thread(in C# too) where a guy was creating a brick breaker game and wanted to best possible collision results from a circular object(a ball). Here is that thread: http://www.vbforums.com/showthread.p...t-half-working

5. ## Re: Circle Collision

My paddle is circular as well. Sorry should have been more specific. I am developing an air hockey game.

6. ## Re: Circle Collision

The same concepts will still apply...

7. ## Re: Circle Collision

Originally Posted by dday9
The same concepts will still apply...
My current code and solution is trying to work out the tangents and normals much like this code here. I want the collisions to be as elastic as possible and take into account mass and velocity of the paddle. I am busy on a few other things at the moment but will be jumping back onto this tonight. I will take a look at the code and see how I go and let you know if it covers what I need

8. ## Re: Circle Collision

I found this explanation together with this C++ code useful for a similar problem. The simplified version is probably more useful to you than the 'remote' version. It should be pretty easy to convert to C#. You might notice that there are no expensive calls in the code so it runs nice and quick.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured