I am trying to create bounding boxes. My goal is not to create them with giving x,y and z coordinates. But rather, I will be loading a model or else rendering a shape - say an aeroplane. The algorithm then should be able to create efficient bounding boxes around it. I am coding in opengl.

Can you help me out with the same?

  • \$\begingroup\$ You want an algorithm that will convert any shapes to a set of boxes, it that it? So with the example of your air plane, you'll need one box for the fuselage, two for the main wings, and three for the tail? \$\endgroup\$ – Vaillancourt Apr 5 '17 at 12:36

I don't think writing such algorithm would be easy if you want it to be completely general and applicable to any whatsoever model.

The best way would be to create by hand your bounding boxes in the same 3D software that you use for creating your airplane. This way, you are able to create boxes which match accurately the model according to your needs. It's also very simple, you just need to draw rectangles.

Then, save those bounding boxes separately and load them into your game as you would with the model itself. Retrieve two opposing vertices of each box and there you have your bounding boxes.

| improve this answer | |
  • \$\begingroup\$ Thanks. Though i already tried that, I was looking for something if available to auto generate it. Trying to work on the same. \$\endgroup\$ – gtushar31 Feb 23 '18 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.