connect two sphere

Hello,

I have spheres that add to the scene by drag and drop and I would like these spheres that connects them visually and physically. It would provide a structure for drag & drop. Drag & drop works fine, but how to connect?

This is a standard CSG (Constructive Solid Geometry) problem. "Standard" in the sense that connecting spheres has been seen before, not in the sense that it's easy.

What you're talking about involves the merging of two meshes, which can be fairly straight forward with really simple geometry, but it's exceptionally difficult to do robustly with completely arbitrary meshes, which is why a function for this task hasn't been implemented.

Take a look at the Wikipedia article at:

http://en.wikipedia.org/wiki/Constructive_solid_geometry

It explains the involved concept. A merger is usually accomplished by representing the geometry as parametric surfaces, which is, thankfully, pretty simple in the case of spheres, and then forming a connected mesh using an algorithm such as Marching Cubes.

There's an example of this approach using precisely two spheres as the geometry in Tomas Akenine-Mller and Eric Haines' book "Real-Time Rendering".