0 votes

I have a chest which is an Area2D set up to do mouse entered/exited and it works fine as long as my player is even with or below the chest, once moving above it the mouse entered/exited events stop firing. It kinda is acting like with other objects using a YSort, so I moved it out of the YSort and still the same behaviour.

Not sure what is going on

Godot version 3.2.2
in Engine by (17 points)

i dont understand: what do you mean with "even, below and above"? isnt this a 2D scene?
are you talking about the z_index property?

sorry, if the player y position is above the chests y position it does not fire, if players y position is below chests then it works. Doesn't matter x position, player can be on left edge of screen and chest on right, just as long as player y is below chest y it will fire.

understood now
first thing i can think of: the player has a "clickable" area and it is interfering with the area of the chest.

if not, you have to share parts of the code, because this is not a normal behaviour of the area2D enter/exit signal.

Player has multiple Area2D's, I turned off pickable just to see if that would matter, it didn't. No clickable areas.

lots of code, not sure what to share.

wanna share the project or a reduced version of it?

I can, but seeing as i'm pretty newbish its probably quite embarrassing.

any direct messaging here to send you a link?

dont be, being noob is the first step to became expert!

you can use google drive and put the link here, and remove it later if you wish

link removed

1 Answer

+1 vote
Best answer

lol, it took me forever to realize: the player has a "GUI" control node which is invisible and that's positionated on the bottom right, therefore when the player is on the top-left of the chest, the chest is not clickable.
Remove that GUI, or if you need it change the mouse_filter setting to pass

by (1,213 points)
selected by

hhmmm, i try setting either or both of the control nodes on the player to pass and still the same problem, are you able to start the game and without moving, mouse over the chest and it highlights?

ya, definitely the control node, not sure why pass/ignore aren't doing anything, it worked once I think. I dont think I need that big one, the small one I do but can size it down.

Thanks for helping me find that

sorry, the setting to use is not pass but ignore, and you have to apply it on both the GUI and the parent Control node, if i do this it works flawless.
Good job by the way!

yes that works

thanks for the help, i'm sure it wont be the last thing I ask about

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 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 webmaster@godotengine.org with your username.