Skip to content

Commit

Permalink
Fix physics picking in Gui in 3D Demo (#1139)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
3 people authored Nov 25, 2024
1 parent 5d95421 commit 6f44371
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions viewport/gui_in_3d/gui_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion viewport/gui_in_3d/gui_panel_3d.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion viewport/gui_in_3d/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 6f44371

Please sign in to comment.