Hi again @RaananW, I’m back with a playground but unfortunately, it behaves differently in the application.
So, to go further in my issue, the purpose here is to make a UI that allows the user to rotate the loaded model. The BoundingInfo comes here for one reason : replace the model on the top of the ground each time the model orientation is modified.
This playground is what I’ve got so far as a reproduction of what’s going on : playground.
Of course it’s a part of it because in the app, there’s no GUI like there but some React UI made in the application (it’s a React web app using Babylonjs inside it) , the camera replaces itself on the model automatically and animations or materials smooth the experience but the idea is here. (I adapted the Babylonjs code, notably zoomOnBoundingInfo for example so i think it was overkill to do it here again).
However, here are the differences between the playground and the app that I noticed as potentially relevant in that case (i will update it if I found new ones) :
- in the app, orientationGUI3DManager, modelTransformNode and uiOn are static variables in the file that are reused in two methods: one setting the ui (which is the case !uiOn in the playground) and one exiting the ui (the else case)
- in the app, the hierarchy of the model I’m testing for now (it could be another one but the structure tends to be the same) contains initially two TransformNodes under the “root” one in cascade (one setting rotation values and one setting scaling values), and under the last one, all the meshes are listed.
- in the app, the ground is created with createDefaultEnvironment with a groundYBias = 0.01
To be positive, I made some improvements since the last time. As you can see, it works quite well now in the playground, except in the case when we stop rotating the model as it is “horizontally” placed. Indeed, when we close and open again the ui, the bounding box is not well placed at first, but we observe the expected behavior then (a transformNode and some updates of the bounding info were needed and i changed the order of some operations to reach that point).
However in the application, where I almost copied and paste what I made in the playground (see differences for more information), the bounding box is just not well placed and the repositioning also goes wrong…
It’s better when I use a custom parent mesh parenting the “root” one (which I use as the rootMesh in the playground). In that case, it behaves close to what expected sometimes but the bounding box shown seems broken.
I don’t know how to show you that, can a quick video of what’s happening be usefull ?
As I read myself, I see that it’s not easy to help on this basis, but if you have any question or further information needed about something, I can try to give more details.
So here I am so far, do you have any lead on how to make it work (even if it invloves a completely different solution) ?
Thanks