Collision with half semi-circle
Posted
by
heitortsergent
on Game Development
See other posts from Game Development
or by heitortsergent
Published on 2011-11-25T15:06:11Z
Indexed on
2011/11/25
18:05 UTC
Read the original article
Hit count: 296
I am trying to port a game I made using Flash/AS3, to the Windows Phone using C#/XNA 4.0. You can see it here: http://goo.gl/gzFiE
In the flash version I used a pixel-perfect collision between meteors (it's a rectangle, and usually rotated) that spawn outside the screen, and move towards the center, and a shield in the center of the screen(which is half of a semi-circle, also rotated by the player), which made the meteor bounce back in the opposite direction it came from, when they collided.
My goal now is to make the meteors bounce in different angles, depending on the position it collides with the shield (much like Pong, hitting the borders causes a change in the ball's angle).
So, these are the 3 options I thought of:
-Pixel-perfect collision (microsoft has a sample(http://create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel_transformed)) , but then I wouldn't know how to change the meteor angle after the collision
-3 BoundingCircle's to represent the half semi-circle shield, but then I would have to somehow move them as I rotate the shield.
-Farseer Physics. I could make a shape composed of 3 lines, and use that as the collision object for the shield.
Is there any other way besides those? Which would be the best way to do it(it's aimed towards mobile devices, so pixel-perfect is probably not a good choice)? Most of the time there's always a easier/better way than what we think of...
© Game Development or respective owner