• Advertisement
Sign in to follow this  

Library to make an OBB or OBB tree from a mesh

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

Advertisement

Not a library but couldnt you do it by your own?

 

The thing that an OBB needs is size/position/rotation data so assuming your mesh is logically located at initial point and rotated to initial degree then the only single thing you need to do is getting into each vertex and store the least and last point in each direction X, Y, Z so you have the size.

 

Getting your OBB is then simply

Center = center;
Extents = size * 0.5f;
Forward = rotation * vec3.unitZ;
Up = rotation * vec3.unitY;
Right = rotation * vec3.unitX;

Share this post


Link to post
Share on other sites
An entire library devoted to such a simple task does not exist. It may be a byproduct of a larger physics library, but based on your question that entails a lot of extra baggage.
It is a 30-minute exercise to write your own. It would literally take more effort to find a library, download it, fix all the compiler errors, link to it, and figure out how to use it than to just spend a few minutes making your own.
You could have written one by the time you got this reply.


L. Spiro

Share this post


Link to post
Share on other sites
Depending on the platform you can choose a math library which also provides this (and basic collision detection using the bounding volumes etc). I know directxmath provides this, if you're platform is Windows

Share this post


Link to post
Share on other sites

Thanks for the tips guys.

 

Not a library but couldnt you do it by your own?

Its not that trivial from what I've seen.  As far as the method you posted I don't think it will output a minimal OBB for an arbitrary mesh.

 

It is a 30-minute exercise to write your own.

Is there any particular algorithm you suggest?  So I can look it up.

 

 

Finding the best orientation for an OBB (not AABB) is not simple, but someone here did intersting research:

 

https://www.gamedev.net/topic/668868-an-exact-algorithm-for-finding-minimum-oriented-bounding-boxes/

Thanks for that I'll take a look.

 

I know directxmath provides this, if you're platform is Windows

Thanks I might end up using this at least temporarily. 

Share this post


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

  • Advertisement