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.
assu$$anonymous$$g 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
Follow this Question
Related Questions
Confused about local, world coordinates when it comes to child objects... 0 Answers
Converting mouse(touch) position with ScreenToWorldPoint doesn't work. 1 Answer
Cell size to Canvas size 1 Answer
How to move object after set it to certain position? [VR Rift] 0 Answers
How to make my Player smaller if he moves the y coordinate up? 1 Answer