Jump to content

how to get the size of a mesh?


hit2501
 Share

Recommended Posts

Thank you very much Temechon I followed your Babylon example It's more closer to the real model with BoundingInfo but I don't know how to use scaleInPlace, I put: mymesh.scaleInPlace(2);

But doesn't work, what am I doing wrong?

Sorry if its too basic, I'm a Babylon noob.

I saw that the units used to show position are different, what kind of unit is used for position and what units for boundingInfo

Once more, thank you

Link to comment
Share on other sites

Sorry, I guess I was too fast as answering (very common these days, I have to calm down:) )

 

This gives you the 'extends' size of your mesh: the number of units between the center of the mesh and the side of the mesh (along x, y and z axis):

var size = sphere.getBoundingInfo().boundingBox.extendSize;

For the sphere in my example, 'size' will then correspond to its radius.

For a box of scaling (1,1,1), this piece of code will returns (0.5,0.5,0.5).

 

If you want to have the diameter, you just have to scale this radius by 2, like this:

var diameter = size.scale(2);

Is it clearer now?

 

To anser to your second question, all units in Babylon are the same: position, boundingInfo, scaling... 

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...