Instantiated an Prefab on a Spherical Object at mouse cursor position

alt text

The example image demonstrates what I'm trying to achieve.

I tried using Recasting from the mouse position but I was getting strange results such as the object instance being far from the surface of the sphere. What would be the best way to go about Instantiating an object at the cursors position on a spherecial object.

Thanks - C

Try this. I am doing a similar thing:

var building : GameObject;

function Update () 
{
    if(Input.GetMouseButtonDown(0))
    {
        Build();
    }
}
function Build()
{
        var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        var hit : RaycastHit;
        if (Physics.Raycast (ray, hit, 100)) 
        {
            Debug.DrawLine (ray.origin, hit.point);
            Instantiate(building,hit.point,Quaternion.identity);
        }
}

Sounds like the collider is not spherical, is it? If a mesh, same mesh for render as collider? Also are you using Physics.Raycast or Collider.Raycast?

Check all the prefabs pivot points making sure there not out of line of the mesh. In other words check if the object is centered at 0,0,0 otherwise you'll get my problem!