diff --git a/Assets/Models/Test1.blend b/Assets/Models/Test1.blend index 81b4577..7f74af7 100644 Binary files a/Assets/Models/Test1.blend and b/Assets/Models/Test1.blend differ diff --git a/Assets/Models/Test1.blend1 b/Assets/Models/Test1.blend1 index 1eff56a..70da8af 100644 Binary files a/Assets/Models/Test1.blend1 and b/Assets/Models/Test1.blend1 differ diff --git a/Prefabs/goldcoin.tscn b/Prefabs/goldcoin.tscn index 71f802f..de42fc5 100644 --- a/Prefabs/goldcoin.tscn +++ b/Prefabs/goldcoin.tscn @@ -46,15 +46,14 @@ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_hrwv8") [sub_resource type="SphereShape3D" id="SphereShape3D_2djid"] -margin = 0.001 +margin = 0.0 radius = 0.124843 [node name="GOLDCOIN" type="RigidBody3D"] collision_layer = 0 +mass = 0.1 continuous_cd = true contact_monitor = true -linear_damp = 1.0 -angular_damp = 1.0 [node name="Cylinder" type="MeshInstance3D" parent="."] material_override = ExtResource("1_2djid") diff --git a/Scenes/TestScene1.tscn b/Scenes/TestScene1.tscn index b690aa3..054268a 100644 --- a/Scenes/TestScene1.tscn +++ b/Scenes/TestScene1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://dbqyyunvx6fdj"] +[gd_scene load_steps=14 format=3 uid="uid://dbqyyunvx6fdj"] [ext_resource type="PackedScene" uid="uid://hmyrn2pbbhpm" path="res://Prefabs/PlayerCamera.tscn" id="2_qq11w"] [ext_resource type="PackedScene" uid="uid://bacgd5lmvaxea" path="res://Prefabs/player.tscn" id="3_hfnh2"] @@ -8,6 +8,7 @@ [ext_resource type="PackedScene" uid="uid://lhqrdftu1js3" path="res://Prefabs/Decorations/tombstone.tscn" id="7_uchfh"] [ext_resource type="PackedScene" uid="uid://d0u2u3cvfkdlj" path="res://Assets/Models/Test1.blend" id="8_46b76"] [ext_resource type="PackedScene" uid="uid://dctwrgdviw2bq" path="res://Prefabs/rat.tscn" id="8_igv2b"] +[ext_resource type="PackedScene" uid="uid://1shngq3vrbu" path="res://coin_spawner.tscn" id="9_46b76"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_31lxn"] sky_top_color = Color(0.1, 0.1, 0.1, 1) @@ -160,3 +161,6 @@ transform = Transform3D(-0.687493, 0, 0.726191, 0, 1, 0, -0.726191, 0, -0.687493 transform = Transform3D(0.0790682, 0, 0.996869, 0, 1, 0, -0.996869, 0, 0.0790682, 2.84781, 0.16998, -2.15342) [node name="Test2" parent="." instance=ExtResource("8_46b76")] + +[node name="CoinSpawner" parent="." instance=ExtResource("9_46b76")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.81324, 3.94453, 0.757049) diff --git a/Scripts/coin_spawner.gd b/Scripts/coin_spawner.gd new file mode 100644 index 0000000..0a1f3c2 --- /dev/null +++ b/Scripts/coin_spawner.gd @@ -0,0 +1,17 @@ +extends Node3D + +const GOLDCOIN = preload("res://Prefabs/goldcoin.tscn") + + + + +func _on_timer_timeout() -> void: + var instance_coin = GOLDCOIN.instantiate() + var av_x = randf_range(-10,10) + var av_y = randf_range(-10,10) + var av_z = randf_range(-10,10) + + instance_coin.global_basis = global_basis + instance_coin.global_position = global_position + instance_coin.angular_velocity = Vector3(av_x,av_y,av_z) + get_tree().current_scene.add_child(instance_coin) diff --git a/Scripts/coin_spawner.gd.uid b/Scripts/coin_spawner.gd.uid new file mode 100644 index 0000000..f648beb --- /dev/null +++ b/Scripts/coin_spawner.gd.uid @@ -0,0 +1 @@ +uid://bn2u3tc7cwlhc diff --git a/coin_spawner.tscn b/coin_spawner.tscn new file mode 100644 index 0000000..92016c2 --- /dev/null +++ b/coin_spawner.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=2 format=3 uid="uid://1shngq3vrbu"] + +[ext_resource type="Script" uid="uid://bn2u3tc7cwlhc" path="res://Scripts/coin_spawner.gd" id="1_7h776"] + +[node name="CoinSpawner" type="Marker3D"] +script = ExtResource("1_7h776") + +[node name="Timer" type="Timer" parent="."] +wait_time = 0.1 +autostart = true + +[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]