Node#setModelBound problem

Hello,



After creating new model I want to modify BoundingVolume for it, but after calling something like

[java]

Node model = (Node) assetManager.loadModel(“Models/Oto/Oto.j3o”);

model.setModelBound(new BoundingBox(v1, v2));

[/java]

model bound (meaning it’s child - geometry, meaning geometry’s mesh) is not updated afaik, could it be because of implementation of Geometry.setModelBound?

[java]

public void setModelBound(BoundingVolume modelBound) {

this.worldBound = null;

mesh.setBound(modelBound);

updateModelBound();

}

[/java]

it sets Geometry’s mesh Bound alright, but then after updateModelBound() mesh bound are reset to initial values.



I’m not sure if it is really a problem or just my misunderstanding, I’ll be glad to have any insight on this.

Actually model bounds are not meant to be used like that.



setModelBound is used internally to initialize the model with the right bound (bounding box, bounding sphere, etc…)

But the model’s bounds are updated each frame to match the real bounds of the mesh. You can’t change the size of the bound.

Thanks for the reply, this concept makes sense.

Actually problem occurred when I tried to load a model, scale it, then compute math collisions on the Node(model’s) worldBounds, but somehow they were not updated with respect to scaling. It was solved by using Node’s Geometry child worldBounds.

That’s a bit not self-evident though, as one would expect after calling Node.scale(f) that it’s bounds will be updated, but that’s just from an outsider perspective, maybe there’s some deeper meaning.