BoundingBox doesn't recalculate when make changes to X3D fields

So I am working on an editor for my game that require to merge (batch) several smaller scenes of the same structure/material into one big scene, by combining vertices/texCoords/indices together, and I notice BoundingBox doesn’t update after combination.

I don’t have a small program to demonstration the problem at the moment, but the steps is like this:

  • Load the scene (glTF file)
  • Make a clone out of it (because I want to combine other scenes’s vertices/indices/texCoords into this one, but still keep the material), by calling Clone method
  • Clear indices/vertices/texCoords of the clone
  • Combine other scenes to the clone, recalculate indices/vertices when needed.
  • Call the clone’s ChangedAll method

I expected the clone’s BoundingBox to be recalculated to match the new data, but looks like it does not . The bbox is still the same like it was before combination, even though the scene’s data is already updated correctly (visual on screen).

Did I miss something? Maybe I need to call something else to trigger the calculation? Please enlighten me :slight_smile:

From your description, it seems you use the original Shape node, and only change the geometry. In this case, you most likely left the explicit bounding box (see ) being stored at the shape node. CGE calculates this box automatically at loading.

So, just do MyShapeNode.BBox := TBox3D.Empty to make the bbox auto-calculated again.

Note: to see how CGE loads glTF, you can

1 Like

Clear BBox field did the trick, thanks.