浏览代码

Improve GUI in 3D demo (#1140)

- Increase physics ticks per second to 120, so that UI interactions feel
  smoother and have lower input lag. This happens since input is governed
  by the physics tick due to the use of physics picking.
- Add a placeholder to the LineEdit and select a default option in the OptionButton.
Hugo Locurcio 9 月之前
父节点
当前提交
5f0e0ce205
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 3 1
      viewport/gui_in_3d/gui_panel_3d.tscn
  2. 4 0
      viewport/gui_in_3d/project.godot

+ 3 - 1
viewport/gui_in_3d/gui_panel_3d.tscn

@@ -59,8 +59,9 @@ horizontal_alignment = 1
 layout_mode = 2
 layout_mode = 2
 text = "A button!"
 text = "A button!"
 
 
-[node name="TextEdit" type="LineEdit" parent="SubViewport/GUI/Panel/VBoxContainer"]
+[node name="LineEdit" type="LineEdit" parent="SubViewport/GUI/Panel/VBoxContainer"]
 layout_mode = 2
 layout_mode = 2
+placeholder_text = "Enter text here..."
 
 
 [node name="HSlider" type="HSlider" parent="SubViewport/GUI/Panel/VBoxContainer"]
 [node name="HSlider" type="HSlider" parent="SubViewport/GUI/Panel/VBoxContainer"]
 layout_mode = 2
 layout_mode = 2
@@ -119,6 +120,7 @@ offset_right = -39.0
 offset_bottom = -147.0
 offset_bottom = -147.0
 grow_horizontal = 0
 grow_horizontal = 0
 grow_vertical = 0
 grow_vertical = 0
+selected = 0
 item_count = 3
 item_count = 3
 popup/item_0/text = "Item 0"
 popup/item_0/text = "Item 0"
 popup/item_1/text = "Item 1"
 popup/item_1/text = "Item 1"

+ 4 - 0
viewport/gui_in_3d/project.godot

@@ -30,6 +30,10 @@ theme/default_theme_scale=2.0
 
 
 3d_physics/layer_2="Control"
 3d_physics/layer_2="Control"
 
 
+[physics]
+
+common/physics_ticks_per_second=120
+
 [rendering]
 [rendering]
 
 
 renderer/rendering_method="gl_compatibility"
 renderer/rendering_method="gl_compatibility"