[gd_scene format=3 uid="uid://dg1b7t2vssf3f"]

[ext_resource type="Script" uid="uid://ckndmko4orxx" path="res://scripts/traincontrol.gd" id="1_amtmp"]
[ext_resource type="Texture2D" uid="uid://bg24v3kb5e73l" path="res://resources/rail2.png" id="1_ihlg3"]
[ext_resource type="PackedScene" uid="uid://csm5ihvpyw5m7" path="res://scenes/main.tscn" id="2_0b1nv"]
[ext_resource type="Script" uid="uid://ck4j0pekoofm1" path="res://scripts/engine.gd" id="2_jgp6u"]
[ext_resource type="ArrayMesh" uid="uid://cm8un80nubjbi" path="res://resources/train kit/train-diesel-a.obj" id="3_jy5c4"]
[ext_resource type="Script" uid="uid://b65vwus8xxmun" path="res://scripts/traincontrol_camera.gd" id="4_jy5c4"]
[ext_resource type="Script" uid="uid://df2oi5vyeak81" path="res://scripts/train_movement.gd" id="6_1lqs8"]

[sub_resource type="PlaneMesh" id="PlaneMesh_23vqf"]
size = Vector2(100, 100)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_23vqf"]
albedo_color = Color(2.153851e-06, 0.25305444, 0.03645257, 1)

[sub_resource type="Curve3D" id="Curve3D_0b1nv"]
closed = true
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, -41.962486, 0.03566742, -44.78871, 0, 0, 0, 0, 0, 0, -7.760188, 0.036315918, -45.60305, 0, 0, 0, 0, 0, 0, 21.603975, 0.03604126, -45.26774, 0, 0, 0, 0, 0, 0, 41.148148, 0.03127289, -39.27994, 0, 0, 0, 0, 0, 0, 44.2618, 0.02154541, -27.064838, 0, 0, 0, 0, 0, 0, 44.118095, 0.0033874512, -4.2633114, 0, 0, 0, 0, 0, 0, 26.96904, 0.003112793, -3.9279928, 0, 0, 0, 0, 0, 0, 3.4968712, 0.0079574585, -10.011598, 0, 0, 0, 0, 0, 0, -3.8321874, 0.024543762, -30.849133, 0, 0, 0, 0, 0, 0, -25.627771, 0.026069641, -32.765224, 0, 0, 0, 0, 0, 0, -31.28027, 0.015075684, -18.969343, 0, 0, 0, 0, 0, 0, -23.472174, 0.003479004, -4.4070177, 0, 0, 0, 0, 0, 0, 12.167218, -0.011207581, 14.035401, 0, 0, 0, 0, 0, 0, 34.681347, -0.013763428, 17.244862, 0, 0, 0, 0, 0, 0, 46.99225, -0.019981384, 25.052942, 0, 0, 0, 0, 0, 0, 42.72894, -0.03504944, 43.97439, 0, 0, 0, 0, 0, 0, 14.897652, -0.036231995, 45.459354, 0, 0, 0, 0, 0, 0, -23.088955, -0.034858704, 43.73488, 0, 0, 0, 0, 0, 0, -44.357616, -0.034965515, 43.878586, 0, 0, 0, 0, 0, 0, -45.603073, -0.010246277, 12.837832, 0, 0, 0, 0, 0, 0, -34.585533, 0.0079422, -10.0116005, 0, 0, 0, 0, 0, 0, -38.321926, 0.022087097, -27.78338),
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}
point_count = 22

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ke0jj"]
albedo_texture = ExtResource("1_ihlg3")
uv1_scale = Vector3(0.235, -4.785, 1)
uv1_offset = Vector3(0, -0.61, 0)

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ihlg3"]
metallic = 1.0
roughness = 0.25

[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_jgp6u"]
sky_top_color = Color(0.6262097, 0.76737565, 0.9309246, 1)
sky_horizon_color = Color(0.82665706, 0.8808251, 0.95468724, 1)
ground_bottom_color = Color(0.5370987, 0.48452926, 0.42358288, 1)
ground_horizon_color = Color(0.7014107, 0.735357, 0.7014107, 1)

[sub_resource type="Sky" id="Sky_o6xl0"]
sky_material = SubResource("ProceduralSkyMaterial_jgp6u")

[sub_resource type="Environment" id="Environment_jy5c4"]
background_mode = 2
background_energy_multiplier = 1.2
sky = SubResource("Sky_o6xl0")
ambient_light_source = 3
ambient_light_color = Color(0.32642248, 0.5324062, 1, 1)
ambient_light_energy = 0.6
tonemap_mode = 3
fog_enabled = true
fog_light_color = Color(0.42881075, 0.64639634, 0.94499296, 1)
fog_density = 0.0015

[sub_resource type="LabelSettings" id="LabelSettings_1lqs8"]
font_color = Color(0, 0, 0, 1)

[node name="TrainControl" type="Node3D" unique_id=840483686]
script = ExtResource("1_amtmp")
main_scene = ExtResource("2_0b1nv")

[node name="Ground" type="MeshInstance3D" parent="." unique_id=263562811]
mesh = SubResource("PlaneMesh_23vqf")
surface_material_override/0 = SubResource("StandardMaterial3D_23vqf")

[node name="Rails" type="Path3D" parent="Ground" unique_id=1160818899]
curve = SubResource("Curve3D_0b1nv")

[node name="Ballast" type="CSGPolygon3D" parent="Ground/Rails" unique_id=259312931]
polygon = PackedVector2Array(-1, 0, -1, 0.1, 1, 0.1, 1, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ke0jj")

[node name="LRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=477776682]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.24889, -4.7985353, 2.2341003)
polygon = PackedVector2Array(-0.5, 0, -0.5, 0.2, -0.4, 0.2, -0.4, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ihlg3")

[node name="RRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=965437995]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.24889, -4.7985353, 2.2341003)
polygon = PackedVector2Array(0.5, 0, 0.5, 0.2, 0.4, 0.2, 0.5, 0)
mode = 2
path_node = NodePath("..")
path_interval_type = 0
path_interval = 1.0
path_simplify_angle = 0.0
path_rotation = 2
path_rotation_accurate = false
path_local = false
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
material = SubResource("StandardMaterial3D_ihlg3")

[node name="TrainEngine" type="PathFollow3D" parent="Ground/Rails" unique_id=973990755]
transform = Transform3D(0.026897233, -2.1416474e-05, -1.1296921, 0, 1.130161, -2.141972e-05, 1.1296905, 5.0991304e-07, 0.02689727, -41.962486, 0.03566742, -44.78871)
rotation_mode = 4
script = ExtResource("2_jgp6u")

[node name="Train" type="MeshInstance3D" parent="Ground/Rails/TrainEngine" unique_id=65189673]
mesh = ExtResource("3_jy5c4")
script = ExtResource("6_1lqs8")

[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1729725358]
shadow_enabled = true
shadow_bias = 0.04

[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=431838059]
environment = SubResource("Environment_jy5c4")

[node name="TrainCamera" type="Camera3D" parent="." unique_id=188013126 node_paths=PackedStringArray("train")]
transform = Transform3D(0.30358428, -0.00013030751, -0.95280457, 0, 1, -0.00013676206, 0.95280457, 4.151881e-05, 0.30358428, 18.173706, 3.0913553, 48.05532)
current = true
fov = 11.9
near = 0.001
script = ExtResource("4_jy5c4")
train = NodePath("../Ground/Rails/TrainEngine/Train")

[node name="HUD" type="Control" parent="." unique_id=563257159]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0

[node name="speed_label" type="Label" parent="HUD" unique_id=1564808190]
layout_mode = 0
offset_left = 20.0
offset_top = 20.0
offset_right = 1280.0
offset_bottom = 43.0
size_flags_vertical = 0
text = "Velocità: 0"
label_settings = SubResource("LabelSettings_1lqs8")

[node name="camera_label" type="Label" parent="HUD" unique_id=1719494020]
layout_mode = 0
offset_left = 20.0
offset_top = 43.0
offset_right = 1280.0
offset_bottom = 66.0
size_flags_vertical = 0
text = "Camera: "
label_settings = SubResource("LabelSettings_1lqs8")

[node name="controls_label" type="Label" parent="HUD" unique_id=1262113688]
layout_mode = 0
offset_left = 20.0
offset_top = 64.0
offset_right = 1280.0
offset_bottom = 217.0
size_flags_vertical = 0
text = "Comandi: 
\"W / S - Accelera / Rallenta\",
\"A / D - Ruota camera\",
\"SPACE - Cambia camera\",
\"TAB - Cambia treno\",
\"ESC - Esci\""
label_settings = SubResource("LabelSettings_1lqs8")
