Skip to content
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

Implement pause-aware picking (3.2) #39421

Merged
merged 1 commit into from
Feb 9, 2021

Conversation

RandomShaper
Copy link
Member

@RandomShaper RandomShaper commented Jun 9, 2020

NOTES:

  • The diff looks super big, but that's because I've moved part of the logic in Viewport's INTERNAL_PHYSICS_PROCESS to a function. The logic changes in that section of code are some checks to let it work with either the classic or the new behavior.
  • This PR is subject to discussion. The right thing to do may not be to have this as a project setting, but trying to find a behavior that involves the good features of the new one while keeping compatibility.
  • Also, in my opinion, the new agreed behavior should become the default and only in 4.0. UPDATE: PR here: Implement pause-aware picking #45775

This adds a new project setting (physics/common/enable_pause_aware_picking). It's disabled by default.

When enabled, it changes the way 2D & 3D physics picking behaves in relation to pause:

  • When pause is set, every collision object that is hovered or captured (3D only) is released from that condition, getting the relevant mouse-exit callback, unless its pause mode makes it immune to pause.
  • During the pause, picking only considers collision objects immune to pause, sending input events and enter/exit callbacks to them as expected.
  • When pause is left, nothing happens. This is a big difference with the classic behavior, which at this point would process all the input events that have been queued, applying them to the current state of the 2D/3D world (in other words, checking them against the current position of the objects instead of those at the time of the events).

Fixes #3703.

@Zireael07
Copy link
Contributor

Any news on this? It's been laying about for 2 months and it fixes a fairly important issue...

@Calinou
Copy link
Member

Calinou commented Aug 5, 2020

@Zireael07 Akien is currently on vacation, so pull requests most likely won't be merged for a week or so. It's also safer to release 3.2.3 first to minimize the risk of regressions in that release.

@akien-mga akien-mga requested a review from reduz October 1, 2020 12:02
@ZackingIt
Copy link

Happy new year's eve any chance this can get a review? Click / signal detection while paused is pretty foundational, the only available work-arounds are pretty janky.

Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! This is very useful. I've tested with pause-immuned objects and pausable objects, and it was acting as expected (after the little fix from my review comment).

Also, before this is merged it would be nice to properly document this project option so users know what to expect.

scene/main/viewport.cpp Outdated Show resolved Hide resolved
editor/project_manager.cpp Show resolved Hide resolved
This adds a new project setting (`physics/common/enable_pause_aware_picking`). It's disabled by default.

When enabled, it changes the way 2D & 3D physics picking behaves in relation to pause:
- When pause is set, every collision object that is hovered or captured (3D only) is released from that condition, getting the relevant mouse-exit callback., unless its pause mode makes it immune from pause.
- During the pause. picking only considers collision objects immune from pause, sending input events and enter/exit callbacks to them as expected.
- When pause is left, nothing happens. This is a big difference with the classic behavior, which at this point would process all the input events that have been queued against the current state of the 2D/3D world (in other words, checking them against the current position of the objects instead of those at the time of the events).
@RandomShaper
Copy link
Member Author

Pushed with the fix for the condition and the new setting documented.

@akien-mga akien-mga merged commit 398a625 into godotengine:3.2 Feb 9, 2021
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the pause_aware_picking_3.2 branch February 9, 2021 10:22
@akien-mga akien-mga modified the milestones: 3.2, 3.3 Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants