Fix physics picking in Gui in 3D Demo (#1139)

Physics picking requires that the SubViewport has a consistent state
of the mouse-enter/exit notifications.

Godot V4.3 was changed in comparison to V4.2, so that it now requires
this additional step.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
This commit is contained in:
Markus Sauermann
2024-11-25 18:38:26 +01:00
committed by GitHub
parent 5d9542113a
commit 6f44371df1
3 changed files with 5 additions and 2 deletions

View File

@@ -30,9 +30,13 @@ func _process(_delta: float) -> void:
func _mouse_entered_area() -> void:
is_mouse_inside = true
# Notify the viewport that the mouse is now hovering it.
node_viewport.notification(NOTIFICATION_VP_MOUSE_ENTER)
func _mouse_exited_area() -> void:
# Notify the viewport that the mouse is no longer hovering it.
node_viewport.notification(NOTIFICATION_VP_MOUSE_EXIT)
is_mouse_inside = false

View File

@@ -121,7 +121,6 @@ grow_horizontal = 0
grow_vertical = 0
item_count = 3
popup/item_0/text = "Item 0"
popup/item_0/id = 0
popup/item_1/text = "Item 1"
popup/item_1/id = 1
popup/item_2/text = "Item 2"

View File

@@ -15,7 +15,7 @@ config/description="A demo showing a GUI instanced within a 3D scene using viewp
as well as forwarding mouse and keyboard input to the GUI."
config/tags=PackedStringArray("3d", "demo", "gui", "official")
run/main_scene="res://gui_in_3d.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.webp"
[debug]