Limit the distance between two objects

Hello, I’m having a new challenge. I want to limit the position of an object in the radius of another object, being able to move it within that radius, but so far, without success. Is it possible to do that? Remembering that the position of the limit has to be circular.

vec = own.worldPosition-other.worldPosition
vec.magnitude = the_max_distance
own.worldPosition = other.worldPosition+vec

try this? maybe

I want it to work like this: