Trying to detect if kinematic body enters an area.

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

(I’m new to Godot, so plz don’t hurt me <3 )

I’m trying to detect if my character enters an area I’ve set up, but it keeps giving me this error:
error(4,1): The method “body_shape_entered” isn’t declared in the current class.

My understanding was it was already a built in method for the area node:

Is there something I need to tell it to unlock it, or do I have to set some values earlier in the script?
Here’s what I’ve got so far:

extends Area

func _physics_process(delta):
	if body_shape_entered($KinematicBody):
		if body.has_method("_in_water"):
			return "yup, you should be drowning"
	return "nope"


I know there are probably much more efficient ways of checking every physics frame, but I’m just trying to make some sort of progress here.
Any and all suggestions are appreciated.


:bust_in_silhouette: Reply From: Inces

Read about signals. Every node class has their built in signals set. All collision objects ( areas and bodies ) have a signals, that fire when their shape is enetered. Learn how to connect those signals to functions in documentation and You are good to go.