0 votes

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.


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:

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):

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?

in Engine by (44 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.