Jump to content
  • Advertisement
Sign in to follow this  
Eralp

Pong-type collision

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm working on a pong-game. I know how to do a basic collision and response between a rectangle and sphere.But I want to give my game a little bit more realistic feeling.(I couldnt explain it) I dont want my paddle to be a rectangle, I want it to be a curve.You know "response" seems more realistic in this way.I learned the billiards style collision and response from a book (SPHERE-SPHERE) but I think with paddle not being a sphere its a little bit harder. I think its called bezier curve&sphere collision ? Do you have any tutorials which explains that? Or can you suggest me another thing? For example I thought about putting 2 triangles on the paddle for giving it a curvish feeling but that wouldn't be so good.(a rectangle at the bottom and 2 triangles on it, like some kind of pyramid..)

Share this post


Link to post
Share on other sites
Advertisement
Well you could do some per pixel collision detection, and then handle the response by looking at the vector? I believe LazyFoo has a tutorial on per pixel collision detection.

Share this post


Link to post
Share on other sites
You already have code to collide circles and rectangles? OK, Just approximate the paddle using a rectangle with a circle on each end.

You could create a curved top by using a large circle, with the gradient you need for your curved paddle, and superimposing a rectangle on the part of the circle you want the ball to collide with. For a ball to collide with the paddle, it must intersect both primitives.

You could approximate many other shapes using a combination of rectangles and circles, and IMHO it would be faster and more efficient than using custom primitives.

For shapes more abstract than curves, you could use per-pixel collision. as per the aforementioned lazy foo article.

Share this post


Link to post
Share on other sites
Quote:
Original post by gb_programmer
You already have code to collide circles and rectangles? OK, Just approximate the paddle using a rectangle with a circle on each end.

You could create a curved top by using a large circle, with the gradient you need for your curved paddle, and superimposing a rectangle on the part of the circle you want the ball to collide with. For a ball to collide with the paddle, it must intersect both primitives.

You could approximate many other shapes using a combination of rectangles and circles, and IMHO it would be faster and more efficient than using custom primitives.

For shapes more abstract than curves, you could use per-pixel collision. as per the aforementioned lazy foo article.


I dont get what you said maybe I need some kind of visualization :S


And Isnt the response of the per-pixel detection hard? I think it must be very hard, I must know all of the normal vectors of "pixels"(I'm sure that there isnt something like that)

But I'll read the Lazy Foo's tutorials, thank you.Lets see what can I do.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!