Updating entire bounding volume tree

Hi, can anyone tell me if it's possible to update a whole subtree of bounding boxes using a single method call? Right now I have to manually track down a specific child and update it using the following code

                ((Node)item).getChild(0).updateGeometricState(0, true);

In other words is there a simple way to accomplish the same using only 'item'?

From my reduced understanding on jME bounds, if you modify the leaves, then the branches containing them will automatically update their bounds. That means you only need to traverse the leaves and update them… Even better, since you most likely have your leaves stored in some nice fields in you application, then just update them directly and that should do the trick.  :wink:

I see :slight_smile: Will have a look at how this can be done as easy as possible. For convenience I might write a method that returns all leave nodes under a given rootNode and post the code here.

If you call updateModelBound on a Node, the call is recursively called on the children on down.  You'd only want to do this if the mesh data has changed or is new, and even then, it's more efficient to only call this on the leaf that has altered/new mesh data.  updateWorldBound is called by updateGeometricState(float, boolean) recursively on the scene, so this is likely already happening on the scene on the update portion of your game loop.

I realise this isn’t actually necessary as renanse just said, but I did write some code to recursively perform an action on all children of a node after a similar discussion a while ago:

http://captiveimagination.com/svn/public/cigame/trunk/src/com/captiveimagination/game/spatial/ Basically the stuff starting with Spatial.