From 9975f69734a46cd23e45a68587f0d810f8821c8a Mon Sep 17 00:00:00 2001 From: xiangsilian Date: Sat, 15 Nov 2025 17:17:27 +0800 Subject: [PATCH] save code --- MyPlayer.cs | 3 ++- MyPlayer.tscn | 6 ++++++ scene/level.tscn | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/MyPlayer.cs b/MyPlayer.cs index 5e10a5b..b518bd8 100644 --- a/MyPlayer.cs +++ b/MyPlayer.cs @@ -24,7 +24,8 @@ public partial class MyPlayer : CharacterBody3D // Get the input direction and handle the movement/deceleration. // As good practice, you should replace UI actions with custom gameplay actions. - Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down"); + Vector2 inputDir = Input.GetVector("left", "right", "forward", "backward"); + Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized(); if (direction != Vector3.Zero) { diff --git a/MyPlayer.tscn b/MyPlayer.tscn index 546272b..d7ff873 100644 --- a/MyPlayer.tscn +++ b/MyPlayer.tscn @@ -16,3 +16,9 @@ mesh = SubResource("CapsuleMesh_kak5s") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) shape = SubResource("CapsuleShape3D_kak5s") + +[node name="Label3D" type="Label3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, 0) +billboard = 1 +text = "我是3D 显示的文字" +font_size = 48 diff --git a/scene/level.tscn b/scene/level.tscn index 3380663..b0fe865 100644 --- a/scene/level.tscn +++ b/scene/level.tscn @@ -43,3 +43,9 @@ transform = Transform3D(40, 0, 0, 0, 0.5, 0, 0, 0, 40, 0, 0, 0) [node name="CollisionShape3D" type="CollisionShape3D" parent="Environment/StaticBody3D"] shape = SubResource("BoxShape3D_s4405") + +[node name="Label" type="Label" parent="."] +offset_right = 400.0 +offset_bottom = 150.0 +theme_override_font_sizes/font_size = 32 +text = "ASDF"