To calculate the height of an Object3D, I use the following method:
let obj = ... ; // An instance of Object3D, such as Mesh or Group
let boundingBox = new THREE.Box3().setFromObject(obj);
let height = Math.abs(boundingBox.min.y - boundingBox.max.y);
However, when the obj
is rotated on the X and/or Z axis, the difference between boundingBox.min.y
and boundingBox.max.y
changes, leading to a different height compared to when it's not rotated.
I aim to determine the height of obj
as if there was no rotation involved. How can I achieve this?
My assumption is that I must adjust the dimensions of boundingBox
based on the rotation angles, but I'm uncertain about the exact process.
Before Rotation:
After Rotation:
(red = obj
, blue = boundingBox
)