Skip to content

Commit 6f44371

Browse files
SauermannCalinouaaronfranke
authored
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 <[email protected]> Co-authored-by: Aaron Franke <[email protected]>
1 parent 5d95421 commit 6f44371

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

viewport/gui_in_3d/gui_3d.gd

+4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ func _process(_delta: float) -> void:
3030

3131
func _mouse_entered_area() -> void:
3232
is_mouse_inside = true
33+
# Notify the viewport that the mouse is now hovering it.
34+
node_viewport.notification(NOTIFICATION_VP_MOUSE_ENTER)
3335

3436

3537
func _mouse_exited_area() -> void:
38+
# Notify the viewport that the mouse is no longer hovering it.
39+
node_viewport.notification(NOTIFICATION_VP_MOUSE_EXIT)
3640
is_mouse_inside = false
3741

3842

viewport/gui_in_3d/gui_panel_3d.tscn

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ grow_horizontal = 0
121121
grow_vertical = 0
122122
item_count = 3
123123
popup/item_0/text = "Item 0"
124-
popup/item_0/id = 0
125124
popup/item_1/text = "Item 1"
126125
popup/item_1/id = 1
127126
popup/item_2/text = "Item 2"

viewport/gui_in_3d/project.godot

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ config/description="A demo showing a GUI instanced within a 3D scene using viewp
1515
as well as forwarding mouse and keyboard input to the GUI."
1616
config/tags=PackedStringArray("3d", "demo", "gui", "official")
1717
run/main_scene="res://gui_in_3d.tscn"
18-
config/features=PackedStringArray("4.2")
18+
config/features=PackedStringArray("4.3")
1919
config/icon="res://icon.webp"
2020

2121
[debug]

0 commit comments

Comments
 (0)