How to compute bounding sphere (center and radius) of GLTF ModelNode


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.


I am wondering if someone have any clue. Thanks in advance.

You can get center using given code:-

Hi there,

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.