What is the right approach to replace geometry of a mesh?

I need make a mesh get the geometry of another mesh without generating new one. For example, a box mesh can become a sphere mesh.

I use geometry.apply to do this, but I’m not sure it’s the recommended approch.

Seems like a reasonable approach.
Whether or not it can be optimized or improved depends on the exact use-case-

If it’s only for a visual change, (the js object itself can change) i would probably use instances instead.
(although normal instances wouldn’t support different colors like your pg)
it would also depend on/if it’s supposed to be able to change back again, since the box geometry reference is now gone (it still exists in scene.geometries array ofc, but add more meshes and suddenly it’s a big mess what is what), etc

1 Like

Thanks for your reply very much.

What now I’m trying to do is to change the form of a mesh in a mesh tree. I’ve config the material and all other properties, when I change the look, i don’t want to apply all the properties to a mesh again. So naturelly I want to just replace the geometry.

Could you elaborate the instances approach? Or Is it ok if I remove the unused geometry object from scene.geometries manually?