This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

(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 "bodyshapeentered" isn't declared in the current class.

My understanding was it was already a built in method for the area node:
https://docs.godotengine.org/en/latest/classes/class_area3d.html

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"):
            body._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.

<3

Godot version 3.4.4 (forgot to update till just now typing this)
in Engine by (12 points)

1 Answer

0 votes

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.

by (8,188 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 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 [email protected] with your username.