Mouse hover enhancement: ability to re-trigger mouse movement processing #6052
Closed
jon-heard
started this conversation in
General Discussions
Replies: 2 comments 1 reply
-
The functionality that you describe as |
Beta Was this translation helpful? Give feedback.
1 reply
-
This can be closed, since godotengine/godot#66625 got merged, which exposed |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
The "_mouse_enter" and "_mouse_exit" signals of the CollisionObject3D class are an easy way to react to the mouse hovering over scene objects. However, relying on these signals is dangerous if the scene changes frequently (camera movement, object movement, new scene, etc). For example, if a mouse is not being moved, but an object it hovers over moves away from it then the "_mouse_exit" signal is not called until the next mouse move, so hover information is invalid until the next mouse move, and whatever reactions the project has to mouse hovering is invalid until that time as well.
Of course, one solution would be for the user to implement their own custom hovering system. This would require some complexities, such as ray-casting, but could be manageable with some study. However, the existing hovering system mostly works fine and my proposed solution is quite simple, at least in concept. Here it is...
Proposal
Add a global function, perhaps called "reevaluate_mouse_position()", that would re-evaluate where the mouse is and emit "_mouse_enter" and "_mouse_exit" signals as appropriate. The user could then call "reevaluate_mouse_position()" whenever the game-logic causes the scene to change. Perhaps the "reevaluate_mouse_position()" function could be as simple as triggering an InputEventMouseMotion event for wherever the mouse currently is positioned.
Reasons for this suggestion:
Beta Was this translation helpful? Give feedback.
All reactions