Oriented Bounding Box

I’ve a problem with OrientedBoundingBox. I want to use it for vehicles. The boxes for the children (wheels etc.) are ok, but the bounding box for the vehicle itself is located at the place the vehicle was originally placed and spins around in all directions. The size seems to be ok:







BoundingBox and BoundingSphere work fine. Any ideas?

Seems like there is a merge bug with OBB.  It's something we are aware of but have been unable to get time and a good enough sample of representative model data to completely fix.

No problem, I can take BoundingBox for now.



BTW: How about a "known bugs" page in the wiki?

You can post a new tracker item on the issue tracker (if it's not already there). The issue tracker also is some sort of "known bugs" list :slight_smile:

Hey there,

I've slammed together a patch fixing this issue.

I post it here because I currently don't know where to send this to have it committed…



Index: OrientedBoundingBox.java
===================================================================
RCS file: /cvs/jme/src/com/jme/bounding/OrientedBoundingBox.java,v
retrieving revision 1.30
diff -u -r1.30 OrientedBoundingBox.java
--- OrientedBoundingBox.java   1 Sep 2006 22:30:39 -0000   1.30
+++ OrientedBoundingBox.java   16 Oct 2006 15:17:26 -0000
@@ -192,7 +192,7 @@

Thanks, I'm checking this out now. :slight_smile:

Definitely much much better, thanks!  I still have a few odd merge issues.  You can see one by loading this model file ( http://www.renanse.com/jme/finobb.jme ) and looking at how the light bounds and the fin bounds merge to make a box that is at an odd angle and maybe too small (or might be okay if rotated correctly.)



If anyone can crack that problem cleanly and consistently - giving us a completely working obb class, I'll send them a jme monkey. :slight_smile:

I can see this problem in jmetest.renderer.TestOrientedBox too i think.

(and to keep this topic fresh :slight_smile: )



The Merged Bounds (bounding tree) don't show at first for this test but only after switching normals on and of (normals !!) or changing the second cylinder to an OrientedBoundingBox as well.



Then i can see that the merged bound is not enclosing the cylinders inside OrientedBoundingBox'es and they are culled if the small merged bound is outside the frustum.


Overlooked this on my first post, but if i switch on and off normals for the TestOrientedBox a few times then the merged bound starts working miraculously

and stop to do after some more switching ???





EDIT: i must correct me one more time  it always seem to work with normals on and always don't work without them.

Just to note: it's working now for me with todays nightly build

That's what we like hearing :slight_smile:

Ah, sorry but it still doesn't work 100 percent. Altough TestOrientedBox works well, it still doesn't when i change the AABB Box to an OBB to.

eg. having 2 oriented bounding boxes does work much better than the prev. version but still the merged bound doesn't fully enclose the 2'nd OBB.

winkman said:

Ah, sorry but it still doesn't work 100 percent. Altough TestOrientedBox works well, it still doesn't when i change the AABB Box to an OBB to.
eg. having 2 oriented bounding boxes does work much better than the prev. version but still the merged bound doesn't fully enclose the 2'nd OBB.


No no...you SAID! Can't go back now...you said it worked so you'll just have to stick with that assertion.  :P

Heh.  Oh well.  I'll take "works better" for now.

Ok, ok, i know i was a bit enthusiastic at first, but i only meant the standard oriented box test to work and take the freedom to revert halfways to:

"works much much better".



@darkfrog: is this acceptable for Your Frogness ?

It is acceptable…  :stuck_out_tongue:

Hmm, this seems like a good candidate for a junit test and/or an entry in next month's bug-squashing contest.



Can anyone here give a concise example of two oriented bounding boxes which aren't being merged correctly?



Some println's in the update method ought to be able to extract this info…

Check out the boundings on the .jme model I attached to an earlier post in this thread.  The individual boundings looked fine, but the merged bounding was incorrect.