Detecting whether a RigidBody2D is inside an Area2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BIGbirddy

Hello, guys.
Since I’m new to the engine,
I’m giving a try on a ping pong game.
Now I have designed some abilities players can use.
One of them is “black hole”, which generate a hole(containsArea2D).
If the ball(RigidBody2D) enters it, the ball will be sucked in to the center and then disappear.

Problem

I set up the center gravity for the area to reach the goal. But when the player
generates the black hole area overlapping with the ball at the beginning, the ball
stays static.
Methods I’ve tried

1. set the ball unable to sleep
I’m thinking that it is because gravity of the area cannot wake ball up.(I don’t know why) So setting the ball unable to sleep can somehow solve this problem.
But I need the sleeping_state_changed() signal in other part in my game.

2. wake up the ball manually when generating the black hole

# black hole script
func _ready():
	...
    # wake up the ball
	var ball_group = get_tree().get_nodes_in_group("ball")
	for b in ball_group:
		b.set_sleeping(false)

I test it out, but the result turns out that the ball go to sleep so quickly,
leading the ball stay static again.

3. set the ball unable to sleep only when that situation happened

func _ready():
    ...
	# check if the ball is already inside
	var ball_group = get_tree().get_nodes_in_group("ball")
	for b in ball_group:
		if absorb_area.overlaps_body(b):
			b.set_can_sleep(false)

This method should work but it doesn’t. I go to check the condition absorb_area.overlaps_body(b) and it show false, which is kind of weird
because the ball is inside the area though.
Is there anything I didn’t consider?