Bounding Info Encapsulation

We are getting weird results from bounding info encapsulateBoundingInfo. Looking at the code, it calls encapsulate on the world minimum and maximum of the bounding info passed in.

 this.encapsulate(toEncapsulate.boundingBox.centerWorld.subtract(toEncapsulate.boundingBox.extendSizeWorld));
 this.encapsulate(toEncapsulate.boundingBox.centerWorld.add(toEncapsulate.boundingBox.extendSizeWorld));

However, the encapsulate function that it calls uses local minimums and maximums.

var minimum = Vector3.Minimize(this.minimum, point);
        var maximum = Vector3.Maximize(this.maximum, point);
        this.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());

This seems like if the bounding box you are encapsulating has a different parent than the one you are encapsulating it with, this function would not work properly. Am i misreading this, or is encapsulation only meant to work if everything is in the same world matrix?

Would be great if you could provide a repro in the playground ?

Sorry, attached: Babylon.js Playground

This PR will fix the problem:

3 Likes

Oh perfect, thank you! Will test that out today

That fixed it! thank you. Do you know what release of babylonjs this will make its way into?

It will be in v6.0 which is scheduled for Thursday :slight_smile:

1 Like