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

Physics Picking Events happen in SubViewport without area restrictions of SubViewportContainer #58902

Closed
Sauermann opened this issue Mar 8, 2022 · 1 comment · Fixed by #57894

Comments

@Sauermann
Copy link
Contributor

Sauermann commented Mar 8, 2022

Godot version

v4.0.alpha.custom_build [31b3bda]

System information

Debian 11, Vulkan

Issue description

Prerequisite:

  • SubViewportContainer with rect_clip_content = true
    • SubViewport (blue area)
      • Area2D + CollisionShape2D (gray + red area)

image

A CollisionShape2D within a SubViewport receives Mouse-events on positions that are not visible in the viewport.
I would expect to receive MouseEnter and MouseExit events at the border of the gray area, however current behavior is that the events trigger in the following way:

  • Enter event at the border of the red area
  • Exit event at the border of the red+gray+blue area

This is related to #28833, but not a duplicate, because this issue is based on_unhandled_input, while the other is based on _gui_input.

The reason for this issue is, that _unhandled_input is propagated by SubViewportContainer to its SubViewport, even if the position of the event is outside of the SubViewportContainer.

This issue can be solved by ensuring that SubViewportContainer propagates events with a position property to its SubViewports _unhandled_input only if the event happens within the area of the SubViewportContainer. The combination of PR #57894 + #58334 fixes this problem.

Steps to reproduce

  1. Load and run MRP
  2. Move mouse over the border of the red area
  3. View Console output

Minimal reproduction project

ViewportPhysicsClip.zip

@Sauermann
Copy link
Contributor Author

Please move to 4.1 since the according PR was also moved to 4.1

@akien-mga akien-mga modified the milestones: 4.0, 4.1 Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants