# Getting position of a coordinate on the surface of a sphere

So I want to create a object B close to another object A, but I'm trying to avoid that A covers B:

I have thinking how to achieve that. Take a look of the following drawing:

I have been thinking in a solution in a math - geometry way before searching for some Unity3D function to solve the problem. I have realise A and B would be on the same surface if the camera is within a sphere with radius c-A. So I guess the solution can be related to get a point at a B at a distance A-B from A on the surface of the sphere with radius c-A. Does it has sense? Any other idea? How to do it with maths and Unity?

let's simplify and say that the camera is the origin. ie, the camera is 0,0.

assuming that, is this what you're after ?

given:
* ptA - the center of circle A
* radiusA - the radius of circle A
* radiusB - the radius of circle B

and you want to find: * ptB - the center of circle B, such that ptB is the same distance from the origin as ptA, and so that circle A and circle B barely touch.

without further constraints, these conditions are impossible to satisfy for all values of ptA, radiusA, radiusB. for example if ptA is say [1, 0] and radiusB is 10000000 then you can't place circle B at the same distance as circle A without them overlapping.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.