*
* @see com.ardor3d.scenegraph.Spatial#updateWorldBound(boolean)
*/
@Override
public void updateWorldBound(final boolean recurse) {
BoundingVolume worldBound = null;
for (int i = getNumberOfChildren() - 1; i >= 0; i--) {
final Spatial child = _children.get(i);
if (child != null) {
if (recurse) {
child.updateWorldBound(true);
}
if (worldBound != null) {
// merge current world bound with child world bound
worldBound.mergeLocal(child.getWorldBound());
// simple check to catch NaN issues
if (!Vector3.isValid(worldBound.getCenter())) {
throw new Ardor3dException("WorldBound center is invalid after merge between " + this + " and "
+ child);
}
} else {
// set world bound to first non-null child world bound