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

Hello !

I want to highlight a sprite when the mouse is over it, so my idea is to put the Sprite into an Area2D, attach to the Area2D a CollisonShape2D and connect the signals mouse_entered and mouse_exited to know if I have to highlight the sprite or not.

The issue is, if those nodes are under a ColorRect (or also under a ReferenceRect), the mouse_entered signal is not fired if the mouse enters the CollisonShape2D where it overlaps the ColorRect/ReferenceRect.

I don't know if it's possible to prevent that ?
I saw the property "Mouse > Filter" in the ColorRect's inspector, and if I set it to ignore, the ColorRect signals about mouse_entered/mouse_exited are not fired but it doesn't change anything about the Area2D :/

I'm still a newbie with Godot, I hope somebody could help me or tell me if I'm doing that wrong. Thanks !

Godot version v3.4
in Engine by (12 points)

Setting mousefilter to ignore or pass actually should work. Perhaps collision shapes have different ways of detecting mouse. Would'nt it be easier if You used some Control node inheritant instead of Area and Collision Shape for your Sprite ? All COntrol nodes detect mouse and they won't compete with each other when mousefilters are correctly set.

Indeed, I tried again and set it to ignore works as expected ! I don't know what I did the first time I tried this but for sure, I did it wrong...
Thank you a lot for your help !

Please log in or register to answer this question.

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.