The calculation of the circumscribed rectangle caused by the version problem is incorrect! How to solve it? Ask for advice!

edition babylonjs@5.0.0 -alpha. The calculation of circumscribed rectangle below 0 is completely correct! babylonjs@5.0.0 -alpha. 0 is wrong to add an external box up
version—babylonjs@5.0.0-alpha.0 VIew


version—babylonjs@5.0.0-alpha.36 VIew


Because the model cannot be uploaded, I use the following model. Please download the following model. Thank you
object.zip (30.2 KB)
he core code is as follows
BABYLON.SceneLoader.ImportMesh("", “/object/”, “object.obj”, scene, function (newMeshes) {
let group = new BABYLON.Mesh(“group”, this.scene);
newMeshes.map(mesh => {
mesh.setParent(group);
});
let childMeshes = group.getChildMeshes();
if(childMeshes.length > 0){
let min = childMeshes[0].getBoundingInfo().boundingBox.minimumWorld;
let max = childMeshes[0].getBoundingInfo().boundingBox.maximumWorld;
for(let i = 0,len = childMeshes.length; i < len; i++){
let meshMin = childMeshes[i].getBoundingInfo().boundingBox.minimumWorld;
let meshMax = childMeshes[i].getBoundingInfo().boundingBox.maximumWorld;
min = BABYLON.Vector3.Minimize(min, meshMin);
max = BABYLON.Vector3.Maximize(max, meshMax);
}
group.setBoundingInfo(new BABYLON.BoundingInfo(min, max));
}
group.showBoundingBox = true;
group.scaling.set(0.1,0.1,0.1);
});
There is also a playground link, but the model can’t be uploaded. Please forgive me
https://playground.babylonjs.com/#FVC542#4

I am sorry I am totally not sure of the question here :frowning:

Could you first try with beta.1 and create a repro in the playground ?

Hello, I re edit the problem. Please look at the following calculation problems caused by the version problem of Babylon. I uploaded the model object.obj

Could you check what is happening in beta 2 ?

also cc @RaananW in case he has a bit of bandwith this week ?

Is there a difference between this question and this:

?

Yes, this is my second submission. If I can’t solve it, I’ll directly mention the GitHub bug. Are you so blind to your product bug? The same code, the calculation error after upgrading the version, you are really good!

Wow dude, are you for real?..

We have a lot of patience, and we do make mistakes. We do fix them as well. But this kind of answer, along with the way you answered my other comments in your other post, really makes it hard to help you. You upload a model, missing the mtl file, which makes it not render correctly. The scene is empty. There is nothing to be seen. I ask - can you please provide this file so we can work on that? or maybe, can you create a playground that will make it much easier to help you. Instead you reply rather impatiently. Do you really think this is the way to get support? From people working on an open source project?

We have a wonderful community, and we really love interacting with them. But honestly, not this way.

Want to see why I asked for the MTL file? This is how it renders on my device:

There is an error. We never denied it. We never said you are wrong, we never said - how dare you claim that we have bugs?. All I asked for was a full reproduction of the issue, so we can debug this.

But wow, that’s the wrong approach to ask.

I’ll try finding time throughout the week to debug this.

2 Likes

I can’t agree more with @RaananW. Please chill out and provide a good repro in the playground.

We will be super happy to fix the issue asap then

How to load external resources on the forum:

Cc @carolhmj to check what is going wrong here

Here is your code with the bunny:
Bunny | Babylon.js Playground (babylonjs.com)

So it should be something different with your object

Looking at the OBJ, it seems to have line definitions. The lines themselves are ignored, but I wonder if the vertices are still being added and affecting the bounding box…

Ok here is the fix:

BABYLON.SceneLoader.ImportMesh("", "./", "object.obj", scene, function (newMeshes) {
        let group = new BABYLON.Mesh("group", this.scene);
        newMeshes.map(mesh => {
            mesh.setParent(group);
        });
        
        let childMeshes = group.getChildMeshes();
        if(childMeshes.length > 0){
            let min = childMeshes[0].getBoundingInfo().boundingBox.minimumWorld;
            let max = childMeshes[0].getBoundingInfo().boundingBox.maximumWorld;
            for(let i = 0,len = childMeshes.length; i < len; i++){
                if (!childMeshes[i].getTotalIndices()) {
                    continue;
                }

                let meshMin = childMeshes[i].getBoundingInfo().boundingBox.minimumWorld;
                let meshMax = childMeshes[i].getBoundingInfo().boundingBox.maximumWorld;
                min = BABYLON.Vector3.Minimize(min, meshMin);
                max = BABYLON.Vector3.Maximize(max, meshMax);
            }
            group.setBoundingInfo(new BABYLON.BoundingInfo(min, max));
        }
        group.showBoundingBox = true;
        group.scaling = new BABYLON.Vector3(0.5, 0.5, 0.5)
    });

The key is:

if (!childMeshes[i].getTotalIndices()) {
   continue;
}

This is because now we do support non triangulated data:
Fix #10605 · BabylonJS/Babylon.js@6e8b644 (github.com)

2 Likes

I feel very serious about my reply. This question has bothered me for a long time. Originally, I didn’t want to get the answer by asking questions, but I tried a lot of methods and didn’t solve it Deleting illegal data in obj file can achieve the desired effect, but this is not the solution. Thank you very much. Please!

Sorry but I’m not sure to understand. Are you not satisfied with my solution?

I told you that the OBJ loader is now more complete and can process un-indexed meshes. I told you how to avoid them. What else?

1 Like

I’m very satisfied with the answer, thank you

Fantastic:)