How to add a BoundingBox?

Hi,

just a beginners question, I think. But: How to add a BoundingBox?

Ok, thats my idea:

I create a rectangle

Rectangle rec = new Rectangle(0, 0, 0, 1.0f, 1.5f, 1.0f, false, true, false, 1.0f);

and add a BoundingBox (instead of the default BoundingSphere)

rec.setBounds(new BoundingBox(new Point3f(-0.5f, -0.75f, -0.5f), new Point3f(.5f, .75f, .5f)));

but the internal source of the Node-object looks like this:

    public final void setBounds(Bounds bounds) {
        this.setBoundsDirtyUpward();
        this.bounds.set(bounds);
    }

“this.bounds” is already instantiated with a BoundingSphere (by Node’s contructor), so how to set a BoundingBox?

Thanks for help,
octane

Have you tried it? Did it throw an error? If not I think it should work like that.

Hi Arne,

yes I tried it an I debuged it - singlestep. With the call “setBounds” (you see in my quote), the “setBounds” of the Node-Class is called. Here is not my BoundingBox-Object assigned, no, it just call the “set()”-function of the BoundingSphere-object, which is already there. This set()-function calculates a sphere from the coordinates of my Box. So this updates the BoundingSphere.

But I like to have a BoundingBox, you know? :slight_smile:

Regards,
octane