So, I've been looking into making a game with pixel movement, which requires some level of collision detection. Last time I did that, I made everything a circle, and just used bounding circles. That's quick, simple, easy, and made sense, because I was doing the Game-In-A-Day competition.
But this time I'm interested in making something much better, which will involve non-circular objects. Bounding ellipses will likely be close enough for the purposes of the game - but I have no idea how to work out if any two ellipses, which can be oriented in any direction, intersect.
Does anyone have any ideas for an algorithm? At first, I thought of simply working out the distance between the two ellipses, the distance from the centre of each ellipse to the edge of it along the line connecting the two, and then working out if one was larger then the other, but I'm not only not sure if that will always work - I have a sneaking suspicion it won't - I'm also not entirely sure how to work out how far away some point on the ellipse is from the centre, given the angle it's at.
Does anyone have any ideas? If you don't, I could always just go with several circles. It'll probably be close enough that the difference is unnoticeable, anyway.
Thanks, Aud. The last two links didn't lead to much useful, but the first one certainly did - from the looks of it, ellipse/ellipse collision is too complex to bother with. I'll just sit with using multiple circles. They're simple.
|
Article on Ellipsoidal Collision Detection: http://www.gamedev.net/reference/articles/article1026.asp
Collision Detection articles: http://www.gamedev.net/reference/list.asp?categoryid=45#199