Creating more than (about)45 bounding boxes in a node, crashes jme visualization

Hi,

My application uses many BoundingBoxes in a single Node.

After makin' tests , I know that this crashes the visualization system.

More than about 45 boundingbox(in my case: OrientedBoundingbox)makes nothing to be displayable.

It's only possible to see bounds.

What can I do to surround this problem?

please post a small example code and describe what you mean with "crashes" - the application exits unexpectedly? or simply does not display anything?

It simply doesn't display anything.



This creates a "grid" of boundingboes computed from points in Vector3f[] vertex.



//the length of the side of each element of the grid

this.microVolumeVertex = itemVertex;



//length of the grid in x,y, and z.

this.xExtent = xExtent;

this.yExtent = yExtent;

this.zExtent = zExtent;



//number of samples in each axis

this.xSamples = Math.round(xExtent / itemVertex);

this.ySamples = Math.round(yExtent / itemVertex);

this.zSamples = Math.round(zExtent / itemVertex);



Vector3f[] vertex = new Vector3f[8];

Point p = null;

OrientedBoundingBox obb = null;



//this loop creates the grid(only points are visible obviously

for (z = 0; z < zSamples; z++) {

for (x = 0; x < xSamples; x++) {

for (y = 0; y < ySamples; y++) {

vertex[0] = new Vector3f(xExtent / xSamples * x, yExtent

/ ySamples * y, zExtent / zSamples * z);

vertex[1] = new Vector3f(xExtent / xSamples * (x + 1),

yExtent / ySamples * y, zExtent / zSamples * z);

vertex[2] = new Vector3f(xExtent / xSamples * (x + 1),

yExtent / ySamples * (y + 1), zExtent / zSamples* z);

vertex[3] = new Vector3f(xExtent / xSamples * x, yExtent

/ ySamples * (y + 1), zExtent / zSamples * z);

vertex[4] = new Vector3f(xExtent / xSamples * x, yExtent

/ ySamples * y, zExtent / zSamples * (z + 1));

vertex[5] = new Vector3f(xExtent / xSamples * (x + 1),

yExtent / ySamples * y, zExtent / zSamples* (z + 1));

vertex[6] = new Vector3f(xExtent / xSamples * (x + 1),

yExtent / ySamples * (y + 1), zExtent / zSamples* (z + 1));

vertex[7] = new Vector3f(xExtent / xSamples * x,

                                                                yExtent/ ySamples * (y + 1), zExtent / zSamples * (z + 1));

obb = new OrientedBoundingBox();



                                //Compute the bounding box from the points

                                obb.setXAxis(vertex[1]);

obb.setYAxis(vertex[3]);

obb.setZAxis(vertex[4]);

p = new Point("" + x + y + z, vertex, null, null, null);

p.setSolidColor(new ColorRGBA(0, 0, 0, 1));



                                //add the point to the Node

                                geometry.attachChild┬ž;

}



Thanks

}

}

The problem occurs only with OrientedBoundingBox!!



Thanks (out of code this time  :D)

The obb you set up in there is not valid (but in the code you have posted you don't even use it ??). Remove the obb stuff you have in your code. Instead do

p.setModelBound( new OrientedBoundingBox() );

p.updateModelBound();



Or read up on obb usage if you really want to define the axes of the obb yourself (e.g. they have to be orthogonal and of length 1)



Btw. please don't post the same problem in two threads.

Sorry, I made a mistake in pasting.

Of course I set the model bound.

Btw I solved the problem using a normal BoundingBox.



I deleted the other thread before creating this.



Thanks for your help.

Ok, but is there really a problem with OBB?  because solving it by switching to another type is not really solving anything for jME.

You're right  :smiley:



I've problems with OBB.

I made an equivalent code with BB and I solved.

For me , OBB has a problem(u can try the code above), but I really have no idea how to solve it,

btw I'm interested and I'd be happy to help u after knowing your impressions.



Thanks

Um, ok.