Calculate a mesh that wrap two spheres of same or different size

Hi to all,
how can I create a mesh that wrap two spheres of same or different size?
I’m trying to use convexgeometry but it doesn’t work.
Here a simple test:

The green spheres should be wrapped by the red geometry, but red geometry looks like a sphere!
What I did wrong?

Thank you

The problem is that cube.geometry.vertices represents the vertices of the cube in local space. You have to transform the points into world space so the convex hull can respect the transformation of your objects. Right now, ConvexBufferGeometry assumes both meshes are placed at the origin (its default position).

Thank you for the answer,
I’ve modified the example following your suggests but It doesn’t work.
What I’m doing wrong?

The world matrices are not up-to-date. Call updateMatrixWorld() after you have modified the position property.

Yes, It works!
Thank you


I’ve fixed, to create convexhull mesh from a COPY of sphere’s vertex transformed with sphere’s World Matrix.
It seems to work better.
Thank you again!