From 6648ac171bc83b4075084fdfadbf0054a1598be5 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Thu, 21 Mar 2024 10:51:28 +0100 Subject: [PATCH] add console element --- app/content/ui/console.tscn | 5 +++-- app/lib/globals/console.gd | 24 ++++++++++++++++++++++++ app/project.godot | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 app/lib/globals/console.gd diff --git a/app/content/ui/console.tscn b/app/content/ui/console.tscn index 682fb56..3cbf0c6 100644 --- a/app/content/ui/console.tscn +++ b/app/content/ui/console.tscn @@ -15,15 +15,16 @@ cull_mode = 2 script = ExtResource("1_ullcc") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0) shape = SubResource("BoxShape3D_6xl4b") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.01, 0, 0) +transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.01, 0, 0) material_override = SubResource("StandardMaterial3D_087gr") mesh = SubResource("QuadMesh_chf50") [node name="Label3D" type="Label3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.477142, 0.00806178, -0.495248) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.477979, 0.492319, 0.001) pixel_size = 0.001 text = "Texst aaa" diff --git a/app/lib/globals/console.gd b/app/lib/globals/console.gd new file mode 100644 index 0000000..bfc3199 --- /dev/null +++ b/app/lib/globals/console.gd @@ -0,0 +1,24 @@ +extends Node + +const console_scene = preload ("res://content/ui/console.tscn") +var _console: Node3D = null + +func _ready(): + get_node("/root/Main").tree_entered.connect(func(): + init_console() + ) + +func init_console(): + _console = console_scene.instantiate() + get_node("/root/Main").add_child(_console) + var camera = get_node("/root/Main/XROrigin3D/XRCamera3D") + + _console.global_position = camera.global_position + camera.global_transform.basis.z * - 1 + _console.global_transform.basis = Basis.looking_at(_console.global_position - camera.global_position) + +func log(message): + print(message, _console) + if _console == null: + init_console() + + _console.log(message) diff --git a/app/project.godot b/app/project.godot index ef8aca1..b526861 100644 --- a/app/project.godot +++ b/app/project.godot @@ -28,6 +28,7 @@ AudioPlayer="*res://lib/globals/audio_player.gd" EventSystem="*res://lib/globals/event_system.gd" Store="*res://lib/globals/main_store.gd" House="*res://lib/globals/house_body.gd" +console="*res://lib/globals/console.gd" [display] @@ -72,6 +73,7 @@ renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4 lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4 +anti_aliasing/quality/msaa_3d=1 viewport/transparent_background=true [xr]