0 votes

Feeling like a real noob for having to ask this and not managing to just find the answer on the web, but I'm having trouble getting an area2d to detect when a rigidbody2d touches it.

Both the rigid body2d and the aea2d have collider objects as children. Both have a shared collision layer. Both have monitoring set to on. Here's the test code I'm using at the moment to get the game to print if an object touches the area 2d:

extends Area2D

func _on_body_enter( body ):
    print(body)

It never seems to activate. Ultimately though, I want to test if the player (a rigidbody2d called "player") is touching it.

Thanks for any ideas!

in Engine by (30 points)

Figured it out thanks to nunod on IRC. I had to double click on the bodyenter signal in the area2d's node tab and enter _onbody_enter as the function to connect it to. Thanks again nunod!

1 Answer

0 votes
Best answer

See comment above.

by (30 points)
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 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.