Get shape properties from Mesh

Is it possible to get some shape properties from a mesh?

I want to get the shape and the diameter from an existing sphere mesh:

const sphere = Mesh.CreateSphere('sphere1', 16, 2, scene)

const shape = sphere.somewhere.shape // Expect it to be 'sphere'
const diameter = sphere.somewhere.diameter // Expect it to be 2

Thanks :slight_smile:

Hello and wlcome @yannick,

sphere.somewhere.diameter

Should IMO be possible with:

sphere.getBoundingInfo().boundingSphere.radius

But unfortunately it currently gives the bounding sphere of the bounding box, I’ll try to fix that.

As for the shape property, it’s not possible like that as you can see in the source file:

It just creates new sphere vertex data (line 66), and applies it to a generic new Mesh (line 117).

1 Like

It is not possible, unless you keep a reference to those parameters. A mesh is an abstract container for vertex data, it doesn’t store the construction parameters

1 Like

Thanks @Gijs and @RaananW!

Both answers helped a lot :slight_smile:

2 Likes