var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", { diameter: 2, segments: 32 }, scene);
sphere.showBoundingBox = true
const boundingInfo = sphere.getBoundingInfo()
const size = boundingInfo.boundingBox.extendSize
console.log(boundingInfo.boundingBox)
const { x, y, z } = size
const box = BABYLON.MeshBuilder.CreateBox('text', { width: x, height: y, depth: z }, scene)
I want to create a box with the same size as the bound size
boundingBox.extendSize & boundingBox.extendSizeWorld, It seems that it does not allow me to accurately obtain the bound size.
let sphereMin = sphere.getBoundingInfo().boundingBox.minimum;
let sphereMax = sphere.getBoundingInfo().boundingBox.maximum;
// this reports the "size" of the targeted object
const size = sphereMax.subtract(sphereMin).length()
extendSize is a vector that defines the amount of additional extension of the bounding box on each axis. Not the actual size, I suggest you use minimumWorld and maximumWorld to calculate the size