Jump to content
  • Advertisement
Sign in to follow this  
PM-Heavy

How to create a bounding box?

This topic is 3767 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

I'm currently working on a pong clone (my first graphical game). The only hard parts left to implement are collision detection and physics. My question is how should I create the bounding boxes for the paddles and ball. I googled this but the links seem to be theoretical or unrelated to my game. I'm using C++ with SFML. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Simply get the min and max vertices of an object. Together with the transformation matrix of the object you get an OBB (oriented bounding box). To check for collisions check whether the OBB of the ball collides with the OBB of the paddle. Source code for this can be easiliy found with goggle. That's it.

Hope this helps you.
Best regards, Porthos.

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!