diff --git a/3d/truck_town/README.md b/3d/truck_town/README.md
index d229ae4bff..b82d6da6e3 100644
--- a/3d/truck_town/README.md
+++ b/3d/truck_town/README.md
@@ -11,6 +11,7 @@ Controls:
- Right Arrow, Gamepad Left Stick, Gamepad D-Pad Right: Steer right
- U, Gamepad Select, left-click speedometer: Change speedometer unit (m/s, km/h, mph)
- C, Gamepad Y/Triangle: Change camera (exterior, interior, top-down)
+- M, Gamepad D-Pad Down: Change mood (sunrise, day, sunset, night)
- Escape, Gamepad D-Pad Up: Go back to menu (press again to exit)
On mobile platforms, the vehicle automatically accelerates. Touch the left and
diff --git a/3d/truck_town/car_select/car_select.gd b/3d/truck_town/car_select/car_select.gd
index 10d0e8100d..6f03ef7032 100644
--- a/3d/truck_town/car_select/car_select.gd
+++ b/3d/truck_town/car_select/car_select.gd
@@ -16,6 +16,14 @@ func _load_scene(car_scene: PackedScene) -> void:
var car: Node3D = car_scene.instantiate()
car.name = "car"
town = preload("res://town/town_scene.tscn").instantiate()
+ if $PanelContainer/MarginContainer/HBoxContainer/Sunrise.button_pressed:
+ town.mood = town.Mood.SUNRISE
+ elif $PanelContainer/MarginContainer/HBoxContainer/Day.button_pressed:
+ town.mood = town.Mood.DAY
+ elif $PanelContainer/MarginContainer/HBoxContainer/Sunset.button_pressed:
+ town.mood = town.Mood.SUNSET
+ elif $PanelContainer/MarginContainer/HBoxContainer/Night.button_pressed:
+ town.mood = town.Mood.NIGHT
town.get_node(^"InstancePos").add_child(car)
town.get_node(^"Spedometer").car_body = car.get_child(0)
town.get_node(^"Back").pressed.connect(_on_back_pressed)
diff --git a/3d/truck_town/car_select/car_select.tscn b/3d/truck_town/car_select/car_select.tscn
index 4732971a86..38a6221e31 100644
--- a/3d/truck_town/car_select/car_select.tscn
+++ b/3d/truck_town/car_select/car_select.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=6 format=3 uid="uid://ckvqraq6j1okh"]
+[gd_scene load_steps=7 format=3 uid="uid://ckvqraq6j1okh"]
[ext_resource type="Script" path="res://car_select/car_select.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://bh7b4n4lg1uqt" path="res://car_select/choose_van.png" id="2"]
@@ -11,6 +11,8 @@ variation_transform = Transform2D(1, 0.2, 0, 1, 0, 0)
spacing_glyph = -1
spacing_space = 4
+[sub_resource type="ButtonGroup" id="ButtonGroup_lcrm3"]
+
[node name="CarSelect" type="Control"]
layout_mode = 3
anchors_preset = 8
@@ -75,6 +77,60 @@ theme_override_fonts/font = SubResource("FontVariation_hqcvw")
theme_override_font_sizes/font_size = 64
text = "Truck Town"
+[node name="PanelContainer" type="PanelContainer" parent="."]
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -325.0
+offset_top = 164.0
+offset_right = 325.0
+offset_bottom = 205.0
+grow_horizontal = 2
+grow_vertical = 2
+
+[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
+layout_mode = 2
+theme_override_constants/margin_left = 20
+theme_override_constants/margin_top = 5
+theme_override_constants/margin_right = 20
+theme_override_constants/margin_bottom = 5
+
+[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer"]
+layout_mode = 2
+
+[node name="Label" type="Label" parent="PanelContainer/MarginContainer/HBoxContainer"]
+custom_minimum_size = Vector2(70, 0)
+layout_mode = 2
+text = "Mood"
+
+[node name="Sunrise" type="CheckBox" parent="PanelContainer/MarginContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+button_group = SubResource("ButtonGroup_lcrm3")
+text = "Sunrise"
+
+[node name="Day" type="CheckBox" parent="PanelContainer/MarginContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+button_pressed = true
+button_group = SubResource("ButtonGroup_lcrm3")
+text = "Day"
+
+[node name="Sunset" type="CheckBox" parent="PanelContainer/MarginContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+button_group = SubResource("ButtonGroup_lcrm3")
+text = "Sunset"
+
+[node name="Night" type="CheckBox" parent="PanelContainer/MarginContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+button_group = SubResource("ButtonGroup_lcrm3")
+text = "Night"
+
[connection signal="pressed" from="HBoxContainer/MiniVan" to="." method="_on_mini_van_pressed"]
[connection signal="pressed" from="HBoxContainer/TrailerTruck" to="." method="_on_trailer_truck_pressed"]
[connection signal="pressed" from="HBoxContainer/TowTruck" to="." method="_on_tow_truck_pressed"]
diff --git a/3d/truck_town/project.godot b/3d/truck_town/project.godot
index cc0216ab1d..8de8b7b678 100644
--- a/3d/truck_town/project.godot
+++ b/3d/truck_town/project.godot
@@ -148,6 +148,12 @@ cycle_camera={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
]
}
+cycle_mood={
+"deadzone": 0.5,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":77,"physical_keycode":0,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
+]
+}
[physics]
@@ -159,11 +165,15 @@ textures/vram_compression/import_etc2_astc=true
lights_and_shadows/directional_shadow/size=8192
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=3
lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=1
+lights_and_shadows/positional_shadow/soft_shadow_filter_quality=3
+lights_and_shadows/positional_shadow/soft_shadow_filter_quality.mobile=1
textures/default_filters/anisotropic_filtering_level=4
textures/default_filters/texture_mipmap_bias=-0.5
textures/decals/filter=1
environment/defaults/default_clear_color=Color(0.133333, 0.133333, 0.133333, 1)
anti_aliasing/quality/msaa_3d=2
anti_aliasing/quality/use_debanding=true
+lights_and_shadows/positional_shadow/atlas_size=2048
+lights_and_shadows/positional_shadow/atlas_size.mobile=1024
anti_aliasing/quality/msaa_3d.mobile=0
scaling_3d/scale.mobile=0.67
diff --git a/3d/truck_town/town/sky_day.tres b/3d/truck_town/town/sky_day.tres
new file mode 100644
index 0000000000..120ebdf8b6
--- /dev/null
+++ b/3d/truck_town/town/sky_day.tres
@@ -0,0 +1,5 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://bpms6jemjgt36"]
+
+[resource]
+sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
+ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
diff --git a/3d/truck_town/town/sky_morning.tres b/3d/truck_town/town/sky_morning.tres
new file mode 100644
index 0000000000..c09e616a00
--- /dev/null
+++ b/3d/truck_town/town/sky_morning.tres
@@ -0,0 +1,6 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://drtvj2ilm4c7h"]
+
+[resource]
+sky_top_color = Color(0.164732, 0.303048, 0.411552, 1)
+sky_horizon_color = Color(0.686775, 0.600323, 0.467043, 1)
+ground_horizon_color = Color(0.686275, 0.6, 0.466667, 1)
diff --git a/3d/truck_town/town/sky_night.tres b/3d/truck_town/town/sky_night.tres
new file mode 100644
index 0000000000..f674dd7107
--- /dev/null
+++ b/3d/truck_town/town/sky_night.tres
@@ -0,0 +1,6 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://c2w5t0j2rkiuu"]
+
+[resource]
+sky_top_color = Color(0.0964875, 0.114707, 0.155705, 1)
+sky_horizon_color = Color(0.201247, 0.148966, 0.125881, 1)
+ground_horizon_color = Color(0.2, 0.14902, 0.12549, 1)
diff --git a/3d/truck_town/town/sky_sunset.tres b/3d/truck_town/town/sky_sunset.tres
new file mode 100644
index 0000000000..9e6c57ca8d
--- /dev/null
+++ b/3d/truck_town/town/sky_sunset.tres
@@ -0,0 +1,6 @@
+[gd_resource type="ProceduralSkyMaterial" format=3 uid="uid://dbs05x6h8miq2"]
+
+[resource]
+sky_top_color = Color(0.252654, 0.288234, 0.368141, 1)
+sky_horizon_color = Color(0.77459, 0.550361, 0.50128, 1)
+ground_horizon_color = Color(0.776471, 0.54902, 0.501961, 1)
diff --git a/3d/truck_town/town/town_scene.gd b/3d/truck_town/town/town_scene.gd
new file mode 100644
index 0000000000..31e6c20bcb
--- /dev/null
+++ b/3d/truck_town/town/town_scene.gd
@@ -0,0 +1,50 @@
+extends Node3D
+
+enum Mood {
+ SUNRISE,
+ DAY,
+ SUNSET,
+ NIGHT,
+ MAX,
+}
+
+var mood := Mood.DAY: set = set_mood
+
+
+func _input(event: InputEvent) -> void:
+ if event.is_action_pressed(&"cycle_mood"):
+ mood = wrapi(mood + 1, 0, Mood.MAX) as Mood
+
+
+func set_mood(p_mood: Mood) -> void:
+ mood = p_mood
+
+ match p_mood:
+ Mood.SUNRISE:
+ $DirectionalLight3D.rotation_degrees = Vector3(-20, -150, -137)
+ $DirectionalLight3D.light_color = Color(0.414, 0.377, 0.25)
+ $DirectionalLight3D.light_energy = 4.0
+ $WorldEnvironment.environment.fog_light_color = Color(0.686, 0.6, 0.467)
+ $WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_morning.tres")
+ $ArtificialLights.visible = false
+ Mood.DAY:
+ $DirectionalLight3D.rotation_degrees = Vector3(-55, -120, -31)
+ $DirectionalLight3D.light_color = Color.WHITE
+ $DirectionalLight3D.light_energy = 1.45
+ $WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_day.tres")
+ $WorldEnvironment.environment.fog_light_color = Color(0.62, 0.601, 0.601)
+ $ArtificialLights.visible = false
+ Mood.SUNSET:
+ $DirectionalLight3D.rotation_degrees = Vector3(-19, -31, 62)
+ $DirectionalLight3D.light_color = Color(0.488, 0.3, 0.1)
+ $DirectionalLight3D.light_energy = 4.0
+ $WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_sunset.tres")
+ $WorldEnvironment.environment.fog_light_color = Color(0.776, 0.549, 0.502)
+ $ArtificialLights.visible = true
+ Mood.NIGHT:
+ $DirectionalLight3D.rotation_degrees = Vector3(-49, 116, -46)
+ $DirectionalLight3D.light_color = Color(0.232, 0.415, 0.413)
+ $DirectionalLight3D.light_energy = 0.7
+ $WorldEnvironment.environment.sky.sky_material = preload("res://town/sky_night.tres")
+ $WorldEnvironment.environment.fog_light_color = Color(0.2, 0.149, 0.125)
+ $ArtificialLights.visible = true
diff --git a/3d/truck_town/town/town_scene.tscn b/3d/truck_town/town/town_scene.tscn
index 7c20eeab4a..ccb588fe89 100644
--- a/3d/truck_town/town/town_scene.tscn
+++ b/3d/truck_town/town/town_scene.tscn
@@ -1,16 +1,14 @@
-[gd_scene load_steps=38 format=3 uid="uid://d0ygmqpylq0wy"]
+[gd_scene load_steps=39 format=3 uid="uid://d0ygmqpylq0wy"]
+[ext_resource type="Script" path="res://town/town_scene.gd" id="1_lr47o"]
[ext_resource type="PackedScene" uid="uid://dfdgytsvtqxwv" path="res://town/truck_town.glb" id="1_x0dmm"]
-[ext_resource type="Script" path="res://spedometer.gd" id="2"]
+[ext_resource type="Script" uid="uid://ikqivupl66lr" path="res://spedometer.gd" id="2"]
+[ext_resource type="Material" uid="uid://bpms6jemjgt36" path="res://town/sky_day.tres" id="2_1df3w"]
[ext_resource type="Texture2D" uid="uid://b2g4dq0w72e68" path="res://town/materials/grass.webp" id="4_cymw0"]
[ext_resource type="Material" uid="uid://bdjiubscxkdn6" path="res://town/materials/cement.tres" id="5_83ty7"]
-[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_2k12y"]
-sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
-ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
-
[sub_resource type="Sky" id="Sky_1gf0c"]
-sky_material = SubResource("ProceduralSkyMaterial_2k12y")
+sky_material = ExtResource("2_1df3w")
[sub_resource type="Environment" id="Environment_dauhq"]
background_mode = 2
@@ -134,12 +132,13 @@ data = PackedVector3Array(-2, 0.5, 2, 2, -0.5, 2, -2, -0.5, 2, -2, 0.5, -2, -2,
data = PackedVector3Array(-2, 1, 2, 2, -1, 2, -2, -1, 2, -2, 1, -2, -2, -1, -2, 2, -1, -2, -2, 1, 2, -2, 1, -2, 2, -1, 2, -2, 1, -2, 2, -1, -2, 2, -1, 2, -2, 1, -2, -2, 1, 2, -2, -1, -2, -2, 1, 2, -2, -1, 2, -2, -1, -2, -2, -1, 2, 2, -1, 2, -2, -1, -2, 2, -1, 2, 2, -1, -2, -2, -1, -2)
[node name="TownScene" type="Node3D"]
+script = ExtResource("1_lr47o")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_dauhq")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
-transform = Transform3D(0.506501, -0.706305, -0.494561, -4.63342e-08, -0.573577, 0.819152, -0.862239, -0.414901, -0.290517, 11.0084, 12.3453, -31.3148)
+transform = Transform3D(-0.793955, 0.350561, -0.496732, -0.295414, 0.491651, 0.819152, 0.531381, 0.797111, -0.286788, 11.0084, 12.3453, -31.3148)
light_energy = 1.45
shadow_enabled = true
shadow_bias = 0.015
@@ -149,6 +148,139 @@ directional_shadow_max_distance = 80.0
[node name="TruckTown" parent="." instance=ExtResource("1_x0dmm")]
+[node name="ArtificialLights" type="Node3D" parent="."]
+visible = false
+
+[node name="OmniLight3D" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, 11.1028, 5.58679, -15.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D2" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -13.8972, 6.58679, -9.17481)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D3" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -12.8972, 6.58679, -36.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D4" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, 9.10282, 8.58679, -37.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D5" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, 18.1028, 8.58679, -47.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D6" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -47.8972, 2.58679, -25.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D7" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -42.8972, 2.58679, -9.17481)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D8" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -71.8972, 5.58679, -25.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D9" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -70.8972, 5.58679, -45.1748)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
+[node name="OmniLight3D10" type="OmniLight3D" parent="ArtificialLights"]
+transform = Transform3D(0.747779, 0.367885, -0.552709, 0, 0.832459, 0.554087, 0.663947, -0.414335, 0.622495, -42.7972, -1.41321, -101.175)
+light_color = Color(1, 0.941176, 0.705882, 1)
+light_energy = 2.0
+shadow_enabled = true
+shadow_bias = 0.06
+shadow_blur = 2.0
+distance_fade_enabled = true
+distance_fade_begin = 100.0
+distance_fade_shadow = 35.0
+distance_fade_length = 15.0
+omni_range = 15.0
+
[node name="InstancePos" type="Marker3D" parent="."]
transform = Transform3D(1.31134e-07, 0, -1, 0, 1, 0, 1, 0, 1.31134e-07, 8, 3.36405, -16)
diff --git a/3d/truck_town/vehicles/meshes/minivan.res b/3d/truck_town/vehicles/meshes/minivan.res
index 65ec6e0029..1a7871ba87 100644
Binary files a/3d/truck_town/vehicles/meshes/minivan.res and b/3d/truck_town/vehicles/meshes/minivan.res differ
diff --git a/3d/truck_town/vehicles/meshes/tow_truck.res b/3d/truck_town/vehicles/meshes/tow_truck.res
index b8c0d622f1..ef022bc154 100644
Binary files a/3d/truck_town/vehicles/meshes/tow_truck.res and b/3d/truck_town/vehicles/meshes/tow_truck.res differ
diff --git a/3d/truck_town/vehicles/meshes/truck_cab.res b/3d/truck_town/vehicles/meshes/truck_cab.res
index 4bdd323aa4..d7948c7243 100644
Binary files a/3d/truck_town/vehicles/meshes/truck_cab.res and b/3d/truck_town/vehicles/meshes/truck_cab.res differ
diff --git a/3d/truck_town/vehicles/meshes/truck_trailer.res b/3d/truck_town/vehicles/meshes/truck_trailer.res
index 04dbc6cf7b..afd1f7ddbc 100644
Binary files a/3d/truck_town/vehicles/meshes/truck_trailer.res and b/3d/truck_town/vehicles/meshes/truck_trailer.res differ
diff --git a/3d/truck_town/vehicles/meshes/wheel.res b/3d/truck_town/vehicles/meshes/wheel.res
index bb8d812081..8f2dcb821e 100644
Binary files a/3d/truck_town/vehicles/meshes/wheel.res and b/3d/truck_town/vehicles/meshes/wheel.res differ