No setting, you'd have to write some code. Not completely sure about the function names, I'd have to look them up. Something along the lines of this:
# asteroid script
var g_pos = get_global_position()
var camera_rect = # get the rectangle for what the camera can "see"
# if asteroid is outside camera bounds:
if g_pos.x < camera_rect.x || g_pos.y < camera_rect.y || g_pos.x > (camera_rect.x + camera_rect.w) || g_pos.y > (camera_rect.y + camera_rect.h):
var new_pos = $indicator_sprite.get_global_position()
# clamping ensures indicator stays in visible area of screen
# sort of a bonus that clamping also ensures indicator is as close to asteroid as possible while still being visible
new_pos.x = clamp(new_pos.x, camera_rect.x, camera_rect.x + camera_rect.w)
new_pos.y = clamp(new_pos.y, camera_rect.y, camera_rect.y + camera_rect.h)
else: # asteroid is inside camera bounds
After writing that out, it doesn't seem as simple to me as I first thought :) I was lazy and left out how to get the camera rect2D, if you would like I can add that bit.
I guess it is simple in that it doesn't put the indicator in a line from the center of the camera to the asteroid (like your answer), but rather it puts the indicator at the closest point to the asteroid that's still onscreen. In some cases, the two approaches put the indicator in the same spot :)
Another note: this approach puts the indicator at exactly the edge of the screen, so it's half offscreen. to fix that, we can simply shrink our camera_rect:
x + margin,
y + margin,
w - (2* margin),
h - (2 * margin). We sort of pretend like the camera shows less than it does, and trick it into putting the indicator sprite in a spot where it's completely visible.
Not totally sure this comment is sensical, so let me know if you have questions :D