Detecting collision between area2d and rigidbody2d?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bugsbane
:warning: Old Version Published before Godot 3 was released.

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!

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

Bugsbane | 2017-06-04 16:03

:bust_in_silhouette: Reply From: Bugsbane

See comment above.