AB4D Forum

Full Version: ModelDecoratorVisual3D BoundingBox
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I load an model with AssimpWpfImporter and show a bounding box (ModelDecoratorVisual3D) for the model. This bounding box is correct.


When I use ModelRotatorVisual3D to rotate the model the bounding box updates, but incorrect. There is too much space between the bounding box and the model.


After an export and new import the bounding box is correct.


So how can I get an correct bounding box after rotation?
The problem is caused because the current version of ModelDecoratorVisual3D is calculating the final bounding box that is shown with transforming the bounding box of the TargetModel3D.

For example if you have the following bounding box:

An if you rotate it, then the ModelDecoratorVisual3D also rotates the bounding box (shown with orange) and this can produce the final bounding box that do not exactly fits the model because it fits the rotated bounding box:

I have improved the ModelDecoratorVisual3D so that it now also have a new CalculateBoundingBoxFromPositions property.

When it is set to true (false by default), the ModelDecoratorVisual3D will calculate the exact bounding box with transforming all the positions of the TargetModel3D.

This will give you the bounding box that will correctly fit the transformed model.

The improved ModelDecoratorVisual3D will be available in the next version of Ab3d.PowerToys. I have send an improved version of the ModelDecoratorVisual3D to the winkimania user. If you would also need that, please send me a PM or email and I will send you a new version of ModelDecoratorVisual3D also.