-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Fix passive mouse hovering for physics #78017
Fix passive mouse hovering for physics #78017
Conversation
scene/main/viewport.cpp
Outdated
mm->set_alt_pressed(Input::get_singleton()->is_physical_key_pressed(Key::ALT)); | ||
mm->set_shift_pressed(Input::get_singleton()->is_physical_key_pressed(Key::SHIFT)); | ||
mm->set_ctrl_pressed(Input::get_singleton()->is_physical_key_pressed(Key::CMD_OR_CTRL)); | ||
mm->set_meta_pressed(Input::get_singleton()->is_physical_key_pressed(Key::META)); |
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.
mm->set_alt_pressed(Input::get_singleton()->is_physical_key_pressed(Key::ALT)); | |
mm->set_shift_pressed(Input::get_singleton()->is_physical_key_pressed(Key::SHIFT)); | |
mm->set_ctrl_pressed(Input::get_singleton()->is_physical_key_pressed(Key::CMD_OR_CTRL)); | |
mm->set_meta_pressed(Input::get_singleton()->is_physical_key_pressed(Key::META)); | |
mm->set_alt_pressed(Input::get_singleton()->is_key_pressed(Key::ALT)); | |
mm->set_shift_pressed(Input::get_singleton()->is_key_pressed(Key::SHIFT)); | |
mm->set_ctrl_pressed(Input::get_singleton()->is_key_pressed(Key::CTRL)); | |
mm->set_meta_pressed(Input::get_singleton()->is_key_pressed(Key::META)); |
I'm not super sure. What do you think?
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.
I'm not versed in these difference between is_physical_key_pressed
and is_key_pressed
and their implications, so I will accept your changes.
Have tested these changes with the MPRs of both linked issues.
Currently mouse hovering doesn't update the state, when collision objects or the camera move. This PR fixes this problem by taking the mouse position from the viewport and not from a nonexistent previous event. Since previous events could potentially be a long time ago, their modifier-key state might be outdated. This PR fetches the current status of modifier-keys from `Input`. These changes allow the removal of some class-variables and making additional simplifications.
23fb1a7
to
543fdc1
Compare
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.
TIWAGOS, but LGTM.
Thanks! |
Currently mouse hovering doesn't update the state, when collision objects or the camera move.
This PR fixes this problem by taking the mouse position from the viewport and not from a nonexistent previous event.
Since previous events could potentially be a long time ago, their modifier-key state might be outdated. This PR fetches the current status of modifier-keys from
Input
.These changes allow the removal of some class-variables and making additional simplifications.
resolve #69708
resolve #75711