-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if input marked handled before processing additional CollisionObjects #48800
Conversation
you can't do this as Area2d's processing order is not determined see #23051 |
@madmiraal sure, but this will change the status of a call to |
I think personally that this is still the right fix for this bug. The bug is that the call to set_input_as_handled() is ignored. The fact that it is randomly taken is it's own other bug which need an other fix i don't see any reason as to why not get this fix put right as if you don't want to be handled randomly you can just not set the input as handled. |
This approach is going to introduce a bug, because Physics Picking can happen in a later frame than the frame in which the event was created. Here is a MRP, that shows this problem: BugPhysicsSetHandled.zip extends Area2D
func _unhandled_input(event):
if (randi_range(0, 1) == 0):
get_viewport().set_input_as_handled()
func _on_input_event(viewport, event, shape_idx):
if (get_viewport().is_input_handled()):
print("ERROR") The following happens:
Frame 2:
This PR would require, that during the evaluation of physics picking the event-handled-status of a previous frame would need to be available, but it isn't. |
@Sauermann The bug you describe is not introduced by this PR. It happens with beta 17 too. Therefore, it is a pre-existing bug that needs it's own issue. |
Because of the described behavior, this PR will introduce the problem, that sometimes InputEvents will be discarded for Physics-Picking, while they are expected to be used for Physics-Picking. So this PR depends on the described behavior to be changed. |
As per the documentation, physics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved in PR-review meeting
Could you rebase for good measure? There doesn't seem to be conflicts but since the commit is now 2 years old, it's probably good to make sure it still passes CI and tests. |
The problem, that I wrote about in my previous message #48800 (comment) has been solved in #79546. |
5056249
to
3a7eda8
Compare
Thanks! |
Currently, when processing picking, all
CollisionObject2D
s under the mouse pointer are processed regardless of whether or notset_input_as_handled()
was called. This PR checks whetherset_input_as_handled()
has been called before processing additionalCollisionObject2D
s.Fixes #48788