How to make a pivot for dropping Object ?

As shown in this picture I have some cogwheels/gears.
the bottom row is actually an inventory box

The script I used for functioning the inventory box is
// instantiate objects with mousebuttondown, while button is held down, move the object at mouse cursor
// also you can pick previously added object and move it around (button held down)

#pragma strict
 
public var ObjectToPlace:Transform; // prefab to instantiate
private var clone:Transform; // hold instantiated object on this variable
private var inventoryOver : boolean = false; // so that you won't make an object everytime you click the mouse
 
// mainloop
function Update () 
{
 
    if(Input.GetButtonDown("Fire1") && inventoryOver == true)
    {
        var ray = Camera.main.ScreenPointToRay (Input.mousePosition); 
        var hit : RaycastHit;
       var layerMask = 1 << 8; // check help page "layerMask", here we only cast ray on layer 8 (prefab layer)
 
 
         layerMask = ~layerMask; // invert layermask, so we dont hit layer 8 (which is for prefabs)
         if (Physics.Raycast (ray, hit, Mathf.Infinity, layerMask)) 
          clone = Instantiate(ObjectToPlace, hit.point, Quaternion.identity); 
 
    }
 
 
 
 
    if(Input.GetButtonUp("Fire1") && inventoryOver == true) // button released
    {
       clone=null; // clear clone variable
       inventoryOver = false;
    }
 
 
 
    if(Input.GetButton("Fire1") && inventoryOver == true) // mousebutton is held down
    {
       if (clone!=null) // if there is some object in clone variable
       {
         var ray2 = Camera.main.ScreenPointToRay (Input.mousePosition); 
         var hit2 : RaycastHit; 
         var layerMask2 = 1 << 8;
         layerMask2 = ~layerMask2; // we are casting rays on other layers, except 8
         if (Physics.Raycast (ray2, hit2, Mathf.Infinity, layerMask2))  // we hit something
          {
              clone.position.x = hit2.point.x; // move our object in x axis
              clone.position.y = hit2.point.y; // move our object in y axis
          }
       }
    }
 
 
}
 
function OnMouseEnter () {
    inventoryOver = true;
}

So, When a gear is being dragged, a clone of that object is made, if it is dropped over a sphere i want it to use the sphere as a pivot point and if it is dropped anywhere else except on the sphere, The clone should be destroyed.

I hope I was clear enough.
Thanx in advance :smiley:

Is the tricky part that the pivot point can be anywhere on the gear – that dropped gears will not snap to the sphere? So, if you drop it about centered on a sphere, the pivot is about centered. But if you drop it with just the edge over a sphere, the gear pivots around it’s edge (which is the center of the sphere?)

If so, can use the empty parent trick on the fly: the draggables all have an empty parent. When you drop them, unchild the model (parent=null,) snap the parent to the center of the sphere, the reparent the model. Unity will auto-compute the new localPosition and, as usual, will spin around the parent.

Or, if each sphere gets only one gear, and the sphere will do the spinning, just child any dropped gear to the sphere.