oschakravarthi

What am I getting same BoundingInfo before and after scaling

Recommended Posts

Hi,I am getting the same BoundingInfo after scaling the mesh.
var bb1 = sphere.getBoundingInfo().boundingBox;
sphere.scaling=new BABYLON.Vector3(2,2,2);
sphere.refreshBoundingInfo();
 
var bb2 = sphere.getBoundingInfo().boundingBox; //I am getting a bounding box with the same values of bb1.
 
var areEqual=bb1.minimumWorld.equals(bb2.minimumWorld) && bb1.maximumWorld.equals(bb2.maximumWorld);
 
alert(areEqual);  //It is showing "true". It should show "false"
 
 
Thanks in advance

Share this post


Link to post
Share on other sites

It is discouraged to keep using this forum, instead create a thread at forum.babylonjs.com

This seems to work: https://www.babylonjs-playground.com/#ASDN0P#2

I (think!) changing the transforms of a mesh only updates the boundingInfo, without creating a new one, so the reference bb1 gets updated as well, making both references bb1 and bb2 the same.

Why the baking of transforms worked, I have no idea, but it seems to be needed in order to work in this example.

Share this post


Link to post
Share on other sites
56 minutes ago, Raggar said:

It is discouraged to keep using this forum, instead create a thread at forum.babylonjs.com

This seems to work: https://www.babylonjs-playground.com/#ASDN0P#2

I (think!) changing the transforms of a mesh only updates the boundingInfo, without creating a new one, so the reference bb1 gets updated as well, making both references bb1 and bb2 the same.

Why the baking of transforms worked, I have no idea, but it seems to be needed in order to work in this example.

Thank you @Raggar. I did not know that forum is available in babylonjs website. I will use forum going forward. Lets complete this question here.

I added a dummy mesh and set it as the parent to my sphere. Now I set the scaling of the parent. It is not working as expected. I have updated the PG https://www.babylonjs-playground.com/#ASDN0P#3

Please have a look and help me.

Thanks in advance.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.