Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Bounding boxes

Just wondering if anyone knows the correct way to use bounding boxes. I assume they are for "non-pixel-perfect-collisions", but I haven't been able to work out how to use them.
 

Zeriab

Sponsor

Uhm... A bounding box is the rectangle with smallest area containing what you want. (points, cicarcle, etc.)
It can be generalized to be a box-like container which has the smallest measurement containing some arbitrary number of elements.

You ask how to use them. Do you mean that you have already created a bunch of rectangles and now want to work out collision-detection with them? Is this correct?
The naive way is simply to check if any box overlap another box. You can use an initial check and then only check boxes when they move.
You can have a grid of some arbitrary size, keep check of which boxes are fully or partly in which parts of the grid. Then you only have to check the relevant parts of the grid for collisions.

I hope this answered at least partly what you asked.

*hugs*
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top