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 body stops receiving input when dragging outside of it's physics shape with capture_input_on_drag enabled (disparity with Godot 3.5) #81645

Closed
dreadpon opened this issue Sep 14, 2023 · 3 comments

Comments

@dreadpon
Copy link

Godot version

4.1-stable

System information

Windows 10 4.1-stable Forward+

Issue description

When clicking a physics body with input_ray_pickable == true and capture_input_on_drag == true and dragging, upon leaving the boundaries of this object, it stops receiving mouse input.

This is in contrast with how it worked in Godot 3.5, where you could click and drag the mouse wherever and body would still receive input events.

This complicates implementation of 3D dragging functionality, since it's very easy for mouse cursor to outpace the object, leave it's area, trigger mouse_exited signal and stop receiving any subsequent input.

Steps to reproduce

  1. Download 2 minimal reproduction projects
  2. Launch 3.5 version, click on a sphere and drag the cursor outside of it
  3. Notice how in Output in never says that mouse exited the sphere unless you release the button
  4. Launch 4.1 version, click on a sphere and drag the cursor outside of it
  5. Notice how in Output there is a mouse exited message as soon as cursor leaves the sphere

Minimal reproduction project

capture_on_drag_3.5.zip
capture_on_drag_4.1.zip

@dreadpon dreadpon changed the title Physics body stops receiving input dragging outside of it's physics shape with capture_input_on_drag enabled (disparity with Godot 3.5) Physics body stops receiving input when dragging outside of it's physics shape with capture_input_on_drag enabled (disparity with Godot 3.5) Sep 14, 2023
@Sauermann
Copy link
Contributor

This got changed intentionally in #68007, so that the signals mouse_entered and mouse_exited now align with the area. The same has been done for Control nodes in #67791.

I believe, that there is a misunderstanding of input_capture_on_drag:
It has no longer any effect on the mouse_entered and mouse_exited signals. But when the flag is true, then the CollisionObject3D will still receive input events, when the mouse is dragged outside of the shape.

Have you tried to overwrite CollisionObject3D._input_event or to listen to the signal CollisionObject3D.input_event?

@dreadpon
Copy link
Author

dreadpon commented Sep 15, 2023

Yes, that works, thank you
The original project where I encountered this had a lot of logic built around mouse_entered and mouse_exited, so I wasn't successful in testing input_event signal

But in a reproduction project above it certainly works

And since CollisionShape3D also receives InputEventMouseButton.pressed == false events, I should use those instead, correct?
If yes, then this can be closed, I'll just have to restructure my code a bit

@Sauermann
Copy link
Contributor

That sounds about right. Closing this issue based on the comment above.

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

2 participants