diff --git a/prefabs/suzanne.tscn b/prefabs/suzanne.tscn index c637434..4553b64 100644 --- a/prefabs/suzanne.tscn +++ b/prefabs/suzanne.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=3 format=3 uid="uid://q5y0ct8qdw8e"] +[gd_scene load_steps=3 format=3 uid="uid://b6xiqhe5i8bej"] [ext_resource type="ArrayMesh" uid="uid://v58ypl1tockm" path="res://meshes/suzanne.obj" id="1_r4k80"] diff --git a/scenes/maptest/maptest.gd b/scenes/maptest/maptest.gd index 48113db..fd80b8a 100644 --- a/scenes/maptest/maptest.gd +++ b/scenes/maptest/maptest.gd @@ -2,6 +2,7 @@ extends Node @onready var world := Node3D.new() +var suzanne := preload("res://prefabs/suzanne.tscn") func _ready() -> void: @@ -23,3 +24,11 @@ func _ready() -> void: await get_tree().physics_frame print("Map load completed in %f seconds" % ((Time.get_ticks_msec() - start_t) / 1000)) add_child(world) + + +func _unhandled_input(event: InputEvent) -> void: + if event is InputEventKey: + if event.physical_keycode == KEY_SPACE and event.pressed: + var node := suzanne.instantiate() as RigidBody3D + add_child(node) + node.global_position = get_viewport().get_camera_3d().global_position diff --git a/scenes/maptest/maptest.tscn b/scenes/maptest/maptest.tscn index 70e95a1..2da1e92 100644 --- a/scenes/maptest/maptest.tscn +++ b/scenes/maptest/maptest.tscn @@ -59,4 +59,9 @@ offset_right = 222.0 offset_bottom = 28.0 text = "Map loader test" +[node name="Label" type="Label" parent="GUI"] +offset_right = 40.0 +offset_bottom = 23.0 +text = "Press space to spawn Suzanne" + [node name="flycam" parent="." instance=ExtResource("3_850h8")]