I was using parentNode.getHierarchyBoundingVectors() to get the min and max bounding vectors, but I realised that my meshes (and thereby their bounding boxes) are arbitrarily rotated, so I’m getting the min and max of all the rotated bounding boxes and not the absolute world min and max vertex, which is what I really want.
What’s the most performant way to find say the highest and lowest vertex in a rotated mesh after transformations have been applied (i.e. absolute world coords), preferably without have to iterate over every and run calculations on every point?
I’ve been trying mesh.getBoundingInfo().boundingBox.minimumWorld but it’s returning exactly the same values as mesh.getBoundingInfo().boundingBox.minimum in my React Native environment with rotated meshes containing arbitrary points.
Likewise with mesh.getBoundingInfo().boundingBox.vectorsWorld and mesh.getBoundingInfo().boundingBox.vectors - they’re producing the same results.
Thanks @flex, I had discovered and tried this but 1) I need to retain the separate mesh transform, and 2) cloning and baking the mesh seems like an expensive operation just to get highest and lowest vertices. But I can use the code in mesh.bakeCurrentTransformIntoVertices() to get the values I want i.e.
let temp = new Array<number>();
let index: number;
for (index = 0; index < data.length; index += 3) {
Vector3.TransformCoordinates(Vector3.FromArray(data, index), transform).toArray(temp, index);
}
Still, I thought mesh.getBoundingInfo().boundingBox.minimumWorld and maximumWorld would give me the same info in a more performant way, but I must be misunderstanding its purpose as it’s not providing the expected results.
Facing similar issue with no rotation, was expecting Minimum World X to return 4 instead of 1 in this Playground thingie I created. Check the in browser console.