|Attention||Topic was automatically imported from the old Question2Answer platform.|
I don’t know if this a bug or something but since today, an Area2D that I use so the character can interact with anything depending on the direction he’s watching has been working weirdly. Today, I just made little changes that don’t affect this Area2D. So here’s the thing, when I want to interact with something it doesn’t work. After testing with prints, I found out that the Area2D detects body_entered and then body_exited instantly after the first one, even does when the body stills on the Area2D collision shape making it unable to interact with it. Is this some bug or I need to check my code?
Edit: Forgot to mention that sometimes that I start the game it works has planned to do and other times does what I mentioned.
Definitely going to need more information haha. wanna show your script for the Area2D’s interaction?
This has only happened to me when I have freed nodes from within an Area2D and it emits the body_exited signal.
scrubswithnosleeves | 2021-02-12 04:49
The Area2D has not coded. But the player does about this and is basically this:
var object = null func _body_entered(body): if body.has_method("interact"): object = body func _body_exited(body): if body.has_method("interact"): object = null
Repertix | 2021-02-12 06:08