Update polyhedron type (and size)

if we instantiate a polyhedron, say with:

let poly = BABYLON.MeshBuilder.CreatePolyhedron(“polyX”, {type: 1, size: 3, updatable: true}, scene);

then:

poly.type = 3

has no effect. Which of the attributes are updatable?

PS. poly.size = 0.1 also has no effect. And changing sizeX, sizeY would intuitively have the same effect, but I found nothing about it or examples.

Thanks!
Renato

ok.

poly.scaling for changing its size, i remembered that now… But what about changing the poly’s type?

You would have to regenerate it would be the easiest way to get a new type.

That method is just generating the mesh data for you, after it’s created you can treat it like any other mesh object.

There are documents on creating custom geometry you can use that as a model if you want to edit it after it’s created with the method you are using. I’m on my phone or I’d pull up the link for you.

1 Like

I am thinking about poly.dispose() and making it again… It does not seem to be the optimum way to do it, but maybe the only way. This is what you mean by regenerating it?

I have seen the custom polyhedron stuff. Thanks for the idea on updating its points, it might be faster than disposing and crating a new one…

Might be comparable/minimal as far as user experience goes.

How often are you calling it? None of it is overly intensive because those are very small buffers.

depends on user settings, but a reasonable context involves 500 calls/second. I believe it would benefit from being updated instead of disposed and created. Am I wrong?

It can get way higher than this, it depends on what the user is after…

So is it that you will have a bunch of instances of the same shape that needs to be updated all at once?

I have a bunch of positions in which the polyhedra are shown.

I got a prototype up, not everything is working, but you may click “LOAD CANVAS”:
http://rfabbri.vicg.icmc.usp.br/evolution
and see it ± working.

PS. I don’t know if I’ll keep this gadget online for very long.

tx again