+1 vote

Using print statements, I have determined that whenever the Player (kinematicBody) enters an Area, both the signal "bodyentered" and "bodyexited" trigger at the same time, consecutively.
It is as if the player exits the area as soon as it enters it, but that can't be possible.

I have checked:
collision layers & masks,
the player movement script,
my version of godot.

I have tried:
Making the area's collision box bigger.

I would like to know
1. Has this happened before
2. What your fix was
3. What the cause was.

I am willing and able to share as much information as needed.

in Engine by (13 points)

I had something similar, solved it by printing the name of the nodes interacting - print(body.get_name()) ended up being a node on the wrong collision layer. Also do you have a raycast on your kinematicBody? That could also trigger the Area.

2 Answers

0 votes

It's either a different area, or your area entered code is moving the player out of the area.

by (1,057 points)
0 votes

Changing layer and mask worked for me.


You can wrap your intended code in if logic.


if (body.name == 'Enemy' || body.name.begins_with('Enemy')):
    #your code snipet
by (14 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.