Bounding box issue solved. Is the "issue" a bug or a feature?

Greetings hard workers. Just curious about the Geometry class. If you create a geometry by doing:

new Geometry(“name”,mesh);

it’s different from creating it:

new Geometry(“name”);

then doing:


The difference is setBoundRefresh() is not called when adding the mesh through the constructor.

Just want to understand this. I have no idea why it’s set this way (what it implies etc.), or if its right or wrong. It caused some issues for me tho.

Btw - if i’m not clear - the lack of setBoundsRefresh() in the constructor caused my issues. I had to do setMesh() in order for it to work. I’m thinking maybe because the box is not properly “attached” before the geometry is transformed and updated otherwise (noticed a boundingbox.transform() in there). The reason I believe this is that positioning seemed to be the problem. The dimensions always came out right.



That sounds like bug to me. Bounds should always be refreshed upon mesh modification

It makes sense to have the geometry update its bounds if a mesh is passed in through the constructor. However that constructor is called by a lot of classes in the core engine, that I am suspicious if there is a reason for it missing. My suspicion is that it is not though and it should be added.

And what I wonder… is why my new Geometry( “foo”, mesh ) geometries have proper bounds then… I wonder how they got them.

@pspeed said:
And what I wonder... is why my new Geometry( "foo", mesh ) geometries have proper bounds then... I wonder how they got them.

If you attach the created geometry to a Node, attachChild() will call setTransformRefresh() which in turns calls setBoundsRefresh() on the geometry.
However if you attach the geometry to a ViewPort (using attachScene), those methods won't be called. Perhaps that's the issue @androlo is experiencing.

…and that kids, is why we have a rootNode ^^

The problem was the bounding boxes wasn’t positioned properly when using the constructor. When using setMesh it works. setMesh solves it so I guess it’s not really an issue. At least not for me.

I think there’s something else happening that setMesh() by accident is able to fix.