Bounding box while applying transformation to model

I am uploading stl file to the scene using stlLoader and drawing bounding box using BoxHelper. Below is the screen shot while uploading the model ,

if you see , bounding box is touching the model in all the sides correctly.

I am rotating the model using transform controls , and updating the bounding box using BoxHelper.update(). If you see bounding box is bigger than the model . the box is not touching the corners of the model correctly. I guess while BoxHelper.update(), tranformation is applied to the box , so box is getting bigger. Is it correct ? is there any way I can get the correct bounding box which will touch the corners of the model correctly ?

I

This:

1 Like

Thanks for the reply. The example is using , model.rotation.set() function. I am using transformControls.js from threejs example directly. I tried setFromObject() function as mentioned in the example. Still it behaves same for me. Am I missing anything here ?

Yes. Most likely there is a bug in your code.

When I try TransformControls, the bounding box is recalculates as expected: