Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Don |
I have drone in my game represented by area2D with animated sprite and with collision shape 2d, i connected mouse entered and mouse exited to collision shape, it works correctly (i see print whenever i hover over it), but when i start my game,
i have one drone on coordinates (32, 32), and when i hover mouse over it, i dont see my print from “_on_Area2D_mouse_entered()” (i have turned on collision shape 2d visibility), only around the edges like 1 or 2 pixel wide it detects mouse, it works correctly on my other areas 2d that have the same script etc. When i unpause the game and let the drone move (even by 1 pixel) it suddenly starts working correctly.
Anyone knows what could be the cuase of this behaviour ?
do you have any controls node in the scene? (eg; buttons, labels, panel)
if the drone on 32 32 is behind one of those (maybe transparent) it will not get any input event from mouse
Andrea | 2021-09-27 14:08
Yes! this was the problem, thank you, i had TextureRect in the scene, which took quite a bit of area, but i didnt think it would interfere with this, since it was empty and wasnt called anywhere in the code.
Don | 2021-09-28 07:18