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

Subviewport's push_input does not do object picking #90413

Closed
krdluzni opened this issue Apr 9, 2024 · 1 comment
Closed

Subviewport's push_input does not do object picking #90413

krdluzni opened this issue Apr 9, 2024 · 1 comment

Comments

@krdluzni
Copy link
Contributor

krdluzni commented Apr 9, 2024

Tested versions

  • Reproducible in v4.3.dev5.official [89f70e9]
  • Not reproducible in v4.3.dev4.official [df78c06], v4.2.1.stable.official [b09f793]

System information

Godot v4.3.dev5 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.5123) - AMD Ryzen 9 7950X 16-Core Processor (32 Threads)

Issue description

When receiving an input event and using push_input to pass it to a SubViewport (that has physics_object_picking set to true), 3d objects do not receive the expected mouse events.

Steps to reproduce

With MRP:

  • Open MRP and run.
  • Click left cube and see that it rotates.
  • Click right (blue) cube and see that it does not rotate.
  • Note that the right cube is being displayed through a SubViewport rendered onto a Sprite2D, and input events on the sprite are being pushed to the SubViewport via push_input.
  • Note that this did work in 4.3.dev4

From scratch:

  • Create a scene with an Area3D (and a matching visual aid) and hook up a print statement to the input_event, mouse_entered, mouse_exited signals. Add a camera to the scene and point it at the Area3D.
  • Wrap the scene in a SubViewport with physics_object_picking enabled.
  • Create a TextureRect outside the SubViewport and set it to display the SubViewport's ViewportTexture.
  • Add an input handler on the TextureRect, and pass the received input to the SubViewport via push_input.
  • Run the scene and note that the signals are not received.

Minimal reproduction project (MRP)

https://github.com/godotengine/godot/files/11975240/SubViewportAndMouseAreaWithChanges.zip, originally posted in response to #79128 as a demonstration of how to propagate input events to a SubViewport is a good demonstration of the behaviour.

One of the cubes rendered is in the scene directly, the other is in a SubViewport having events pushed to it. If you click the cubes, they should randomly rotate themselves. In 4.3.dev4 and earlier, they do. In 4.3.dev5 the one in a SubViewport does not.

@Sauermann
Copy link
Contributor

Thank you for the report.
This change got introduced by #88992.

A way to mitigate this is shown in this project: SubViewportAndMouseAreaWithChangedChanges.zip
Make sure, that the SubViewport receives mouse-entered/exited notifications, when the mouse enters/exits the sprite.

Since this problem has already been reported in #89757, I will consolidate this issue as a duplicate with #89757.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants