# Help with handling ellipse collisions

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

## Recommended Posts

Ok so I know how to calculate if two ellipses have intersected, but now I want to move my ellipses after they have intersected(ie one slides off of the other). I have an idea on how to do it in my head, but it will only work if two ellipses are the same size. I want to be able to handle the collision of two axis aligned ellipses of any size. For starters, I think I probably need to find the point of intersection but I'm not sure how to do that. Any help would be appreciated, thanks.

Here's the code for seeing if two ellipses have intersected:

//Returns true if the pixel is inside the ellipse bool CollisionCheckPixelInEllipse(Vector2d pixel, Vector2d center, Vector2d radius) { int asquare = radius.x * radius.x; int bsquare = radius.y * radius.y; return ((pixel.x-center.x)*(pixel.x-center.x)*bsquare + (pixel.y-center.y)*(pixel.y-center.y)*asquare) < (asquare*bsquare); } // returns true if the two ellipses overlap bool CollisionCheckEllipses(Vector2d center1, Vector2d radius1, Vector2d center2, Vector2d radius2) { int radiusSumX = (int) (radius1.x + radius2.x); int radiusSumY = (int) (radius1.y + radius2.y); return CollisionCheckPixelInEllipse(center1, center2, Vector2d(radiusSumX, radiusSumY)); }

EDIT: It appears this thread was posted twice by accident
EDIT2: I might just not use ellipse collisions after all

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634092
• Total Posts
3015448
×