Jump to content

What am I getting same BoundingInfo before and after scaling


oschakravarthi
 Share

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
Link to comment
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.

Link to comment
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.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...