The lowdown on model bounds?

Just a quick question: is there a webpage somewhere that describes the lowdown on model bounds? Like, when do they get created automatically, when do we need to call updateModelBounds(), and when should we create them manually etc. I don’t think I’ve ever used the correctly (or efficiently), but I can’t find a page that deals with them.


they get created when updateModelBounds is called. Internal implementations deal with this for you, as you should with your custom mesh/geometry.

for example the internal shapes (box, sphere, torus) do this after generation.

you should call updateMeshBounds and updateGeometryBounds whenever you change the size of it. usually when you edit it. you should generally know when it’s likely.

one might make their own for a collision shape around a camera. a boundingsphere i could use to check for collisions with.

Thanks for the answer. So, just to clarify, if I’m using simple Geometries like a Box, I don’t need to call anything unless I change its size, even if I move it? Also, what about if I have a Node that has a single Box as a child. If I move the node, do I need to call anything to update the boundingbox of the Box?

if you use the given methods of the internal shapes, i’d think the set size methods would do it for you. if you move it’s local translation then yes because it’s bounds have changed.

if you move a node, the children’s local translation remains the same. as does the mesh if you move the geometry. the parent moves. the child’s local translation in reference does not.

which would mean the child’s world translation is the sum of its parents plus itself. which is true.

i should say… the box is a mesh. which is encapsulated in a geometry. so the box is now a child. move the geometry now, not the box. and so on. then update the children only when required.

If you use JME’s shapes and you’ve already displayed the Geometry… then if you change the shape’s size you will need to tell the Geometry that its size has changed using updateModelBound().

…the mesh should have already updated its own bound in that case (or cleared it for regeneration).

Also, the code is two clicks away and will be way more detailed (and easier) than any answer we give here.

Thanks for the clarification. I’ve discovered that my problem was calling setLocalTranslation() and not move().