I am working a GLTF model using CesiumJS. I am able to query various ModelNode from the loaded GTLF model.
Next, I would like to compute the bounding box or bounding sphere of few ModelNode in world coordinate system. Is there any example which I can refer to.
The bounding sphere for a node would be computed from the node’s transform. This should be available via the ModelNode.matrix property, then you will need to multiply by the top-level model matrix.
The center of the bounding sphere would be the translate component of the matrix * the scaling component of the matrix, and the radius would be the scaling component of the matrix.
Hi Gabby,
I’m calculating the center and radius as you suggested. However, it appears that the latitude and longitude values are correct, but the height value is being calculated incorrectly. As a result, the red sphere I’m trying to display at the center position does not appear to be in the correct location. Could you please let me know what might be causing this issue?