Clean up and fix Truck Town

This commit is contained in:
Jonathan Nicholl
2022-08-25 16:26:31 -04:00
parent 044afe7976
commit 3d4947bcb5
53 changed files with 573 additions and 2355 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
albedo_color = Color( 0.0387451, 0, 0.256549, 1 )
metallic = 0.2
roughness = 0.6

View File

@@ -1,5 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
albedo_color = Color( 0.248353, 0.248353, 0.248353, 1 )
roughness = 0.0

View File

@@ -1,5 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
albedo_color = Color( 0.742188, 0.33499, 0.156555, 1 )
roughness = 0.0

View File

@@ -1,5 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
albedo_color = Color( 0.256575, 0.0334902, 0, 1 )
roughness = 0.6

View File

@@ -1,7 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
albedo_color = Color( 0.64, 0.64, 0.64, 1 )
metallic = 0.3
metallic_specular = 0.6
roughness = 0.0

View File

@@ -1,7 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "Material.001"
albedo_color = Color( 0.256549, 0.225529, 0, 1 )
metallic = 0.1
roughness = 0.6

View File

@@ -1,9 +0,0 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=2]
[ext_resource path="res://Images/cement.png" type="Texture2D" id=1]
[resource]
resource_name = "Cement"
albedo_texture = ExtResource( 1 )
roughness = 0.8
uv1_scale = Vector3( 2, 2, 2 )

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "vertexColorShader"
albedo_color = Color( 0.559608, 0.476667, 0.127098, 1 )
roughness = 0.5

View File

@@ -1,9 +0,0 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=2]
[ext_resource path="res://Images/grass.png" type="Texture2D" id=1]
[resource]
resource_name = "Grass"
albedo_texture = ExtResource( 1 )
roughness = 0.8
uv1_scale = Vector3( 2, 2, 2 )

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "Material.001"
albedo_color = Color( 0.905529, 0.87102, 0.614314, 1 )
roughness = 0.0

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "Material"
albedo_color = Color( 0.17622, 0.025098, 0.0206667, 1 )
roughness = 0.0

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "vertexColorBIBase"
albedo_color = Color( 0.332031, 0.0233459, 0.0233459, 1 )
roughness = 0.6

View File

@@ -1,6 +0,0 @@
[gd_resource type="StandardMaterial3D" format=2]
[resource]
resource_name = "Material.002"
albedo_color = Color( 0.0563922, 0.0104314, 0.00341176, 1 )
roughness = 0.0

View File

@@ -3,13 +3,9 @@
This is a demo implementing different types of trucks of
varying complexity using vehicle physics.
Do not be surprised if everything is bouncy and glitchy,
Godot's physics system is not polished and will likely be
reworked in the future.
Language: GDScript
Renderer: GLES 2
Renderer: Vulkan Clustered
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/524

File diff suppressed because one or more lines are too long

View File

@@ -1,23 +1,25 @@
extends Control
var town = null
var town: Node3D = null
func _process(_delta):
func _process(_delta: float):
if Input.is_action_just_pressed(&"back"):
_on_Back_pressed()
_on_back_pressed()
func _load_scene(car):
var tt = load(car).instantiate()
tt.name = &"car"
func _load_scene(car_path: String):
var car: Node3D = load(car_path).instantiate()
car.name = &"car"
town = load("res://town_scene.tscn").instantiate()
town.get_node(^"InstancePos").add_child(tt)
town.get_node(^"Back").connect(&"pressed", self._on_Back_pressed)
town.get_node(^"InstancePos").add_child(car)
town.get_node(^"InstancePos/Panel/Spedometer").car_body = car.get_child(0)
town.get_node(^"Back").pressed.connect(_on_back_pressed)
get_parent().add_child(town)
hide()
func _on_Back_pressed():
func _on_back_pressed():
if is_instance_valid(town):
# Currently in the town, go back to main menu.
town.queue_free()
@@ -27,13 +29,13 @@ func _on_Back_pressed():
get_tree().quit()
func _on_MiniVan_pressed():
func _on_mini_van_pressed():
_load_scene("res://car_base.tscn")
func _on_TrailerTruck_pressed():
func _on_trailer_truck_pressed():
_load_scene("res://trailer_truck.tscn")
func _on_TowTruck_pressed():
func _on_tow_truck_pressed():
_load_scene("res://tow_truck.tscn")

View File

@@ -1,11 +1,13 @@
[gd_scene load_steps=5 format=3 uid="uid://bbpqesu2qnd2j"]
[gd_scene load_steps=5 format=3 uid="uid://dgjvvywy4m0jo"]
[ext_resource type="Script" path="res://car_select.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://bh7b4n4lg1uqt" path="res://Images/choose_van.png" id="2"]
[ext_resource type="Texture2D" uid="uid://hvkcmpdq1t0k" path="res://Images/choose_trailer.png" id="3"]
[ext_resource type="Texture2D" uid="uid://de7itkxhl0u28" path="res://Images/choose_tow.png" id="4"]
[ext_resource type="Texture2D" uid="uid://bh7b4n4lg1uqt" path="res://textures/choose_van.png" id="2"]
[ext_resource type="Texture2D" uid="uid://hvkcmpdq1t0k" path="res://textures/choose_trailer.png" id="3"]
[ext_resource type="Texture2D" uid="uid://de7itkxhl0u28" path="res://textures/choose_tow.png" id="4"]
[node name="CarSelect" type="Control"]
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
@@ -14,41 +16,49 @@ offset_left = -512.0
offset_top = -300.0
offset_right = 512.0
offset_bottom = 300.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource( "1" )
__meta__ = {
"__editor_plugin_screen__": "2D",
"_edit_use_anchors_": false
}
script = ExtResource("1")
[node name="MiniVan" type="Button" parent="."]
offset_left = 4.0
offset_top = 160.0
offset_right = 340.0
offset_bottom = 400.0
size_flags_horizontal = 2
size_flags_vertical = 2
icon = ExtResource( "2" )
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="TrailerTruck" type="Button" parent="."]
offset_left = 344.0
offset_top = 160.0
offset_right = 680.0
offset_bottom = 401.0
size_flags_horizontal = 2
size_flags_vertical = 2
icon = ExtResource( "3" )
[node name="MiniVan" type="Button" parent="HBoxContainer"]
layout_mode = 2
offset_left = 5.0
offset_right = 333.0
offset_bottom = 243.0
size_flags_horizontal = 6
size_flags_vertical = 4
icon = ExtResource("2")
[node name="TowTruck" type="Button" parent="."]
offset_left = 684.0
offset_top = 160.0
offset_right = 1020.0
offset_bottom = 400.0
size_flags_horizontal = 2
size_flags_vertical = 2
icon = ExtResource( "4" )
[node name="TrailerTruck" type="Button" parent="HBoxContainer"]
layout_mode = 2
offset_left = 347.0
offset_right = 675.0
offset_bottom = 243.0
size_flags_horizontal = 6
size_flags_vertical = 4
icon = ExtResource("3")
[connection signal="pressed" from="MiniVan" to="." method="_on_MiniVan_pressed"]
[connection signal="pressed" from="TrailerTruck" to="." method="_on_TrailerTruck_pressed"]
[connection signal="pressed" from="TowTruck" to="." method="_on_TowTruck_pressed"]
[node name="TowTruck" type="Button" parent="HBoxContainer"]
layout_mode = 2
offset_left = 690.0
offset_right = 1018.0
offset_bottom = 243.0
size_flags_horizontal = 6
size_flags_vertical = 4
icon = ExtResource("4")
[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"]

View File

@@ -5,10 +5,12 @@ 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 = SubResource("ProceduralSkyMaterial_2k12y")
[resource]
background_mode = 2
sky = SubResource( "Sky_1gf0c" )
sky = SubResource("Sky_1gf0c")
tonemap_mode = 2
glow_enabled = true
glow_intensity = 0.5
glow_blend_mode = 1

View File

@@ -1,31 +1,20 @@
extends Camera3D
@export var min_distance = 2.0
@export var max_distance = 4.0
@export var angle_v_adjust = 0.0
var collision_exception = []
@export var height = 1.5
@export var min_distance := 2.0
@export var max_distance := 4.0
@export var angle_v_adjust := 0.0
@export var height := 1.5
func _ready():
# Find collision exceptions for ray.
var node = self
while(node):
if (node is RigidDynamicBody3D):
collision_exception.append(node.get_rid())
break
else:
node = node.get_parent()
# This detaches the camera transform from the parent spatial node.
set_as_top_level(true)
func _physics_process(_delta):
var target = get_parent().get_global_transform().origin
var pos = get_global_transform().origin
var target: Vector3 = get_parent().global_transform.origin
var pos := global_transform.origin
var from_target = pos - target
var from_target := pos - target
# Check ranges.
if from_target.length() < min_distance:
@@ -40,6 +29,4 @@ func _physics_process(_delta):
look_at_from_position(pos, target, Vector3.UP)
# Turn a little up or down
var t = get_transform()
t.basis = Basis(t.basis[0], deg2rad(angle_v_adjust)) * t.basis
set_transform(t)
transform.basis = Basis(transform.basis[0], deg_to_rad(angle_v_adjust)) * transform.basis

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -29,5 +29,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,9 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dwpeihw7c20hb"]
[ext_resource type="Texture2D" uid="uid://deeixbwehify0" path="res://textures/cement.png" id="1"]
[resource]
resource_name = "Cement"
albedo_texture = ExtResource("1")
roughness = 0.8
uv1_scale = Vector3(2, 2, 2)

View File

@@ -0,0 +1,9 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dy1i6vuu24ovq"]
[ext_resource type="Texture2D" uid="uid://cltpie6eq33br" path="res://textures/grass.png" id="1"]
[resource]
resource_name = "Grass"
albedo_texture = ExtResource("1")
roughness = 0.8
uv1_scale = Vector3(2, 2, 2)

View File

@@ -0,0 +1,7 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://cebi0gcdtlo4k"]
[ext_resource type="Texture2D" uid="uid://q7uvsiqefkwr" path="res://textures/truck_trailer.png" id="1_jkh55"]
[resource]
albedo_texture = ExtResource("1_jkh55")
roughness = 0.6

1
3d/truck_town/meshes/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.res

Binary file not shown.

View File

@@ -0,0 +1,99 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dsb8h0h6axw1b"
path="res://.godot/imported/meshes.glb-8f0c4b5a77cea1398eb09a33df9d7e1c.scn"
[deps]
source_file="res://meshes/meshes.glb"
dest_files=["res://.godot/imported/meshes.glb-8f0c4b5a77cea1398eb09a33df9d7e1c.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
import_script/path=""
_subresources={
"materials": {
"car_blue": {
"use_external/enabled": false,
"use_external/path": "res://materials/car_blue.tres"
},
"car_yellow": {
"use_external/enabled": false,
"use_external/path": "res://materials/car_red.tres"
},
"chrome": {
"use_external/enabled": false,
"use_external/path": "res://materials/chrome.tres"
},
"truck_trailer": {
"use_external/enabled": true,
"use_external/path": "res://materials/truck_trailer.tres"
}
},
"meshes": {
"meshes_minivan": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://meshes/minivan.res"
},
"meshes_tow_truck": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://meshes/tow_truck.res"
},
"meshes_truck_cab": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://meshes/truck_cab.res"
},
"meshes_truck_trailer": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://meshes/truck_trailer.res"
},
"meshes_wheel": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://meshes/wheel.res"
}
}
}

View File

@@ -12,21 +12,15 @@ config_version=5
config/name="Truck Town"
config/description="This is a demo implementing different types of trucks of
varying complexity using vehicle physics.
Do not be surprised if everything is bouncy and glitchy,
Godot's physics system is not polished and will likely be
reworked in the future."
varying complexity using vehicle physics."
run/main_scene="res://car_select.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
config/icon="res://icon.png"
[display]
window/stretch/mode="2d"
window/stretch/aspect="expand"
window/height=720
window/width=1280
[input]
@@ -71,6 +65,7 @@ shadow_filter=3
[rendering]
anti_aliasing/quality/screen_space_aa=1
quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_etc=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

After

Width:  |  Height:  |  Size: 686 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

View File

@@ -1,15 +1,17 @@
extends Button
enum SpeedUnit {
METERS_PER_SECOND = 0,
KILOMETERS_PER_HOUR = 1,
MILES_PER_HOUR = 2,
METERS_PER_SECOND,
KILOMETERS_PER_HOUR,
MILES_PER_HOUR,
}
@export var speed_unit: SpeedUnit = SpeedUnit.METERS_PER_SECOND
var car_body: VehicleBody3D
func _process(_delta):
var speed = get_parent().get_parent().get_child(1).get_child(0).linear_velocity.length()
var speed := car_body.linear_velocity.length()
if speed_unit == SpeedUnit.METERS_PER_SECOND:
text = "Speed: " + ("%.1f" % speed) + " m/s"
elif speed_unit == SpeedUnit.KILOMETERS_PER_HOUR:
@@ -20,5 +22,5 @@ func _process(_delta):
text = "Speed: " + ("%.0f" % speed) + " mph"
func _on_Spedometer_pressed():
speed_unit = (speed_unit + 1) % 3
func _on_spedometer_pressed():
speed_unit = ((speed_unit + 1) % SpeedUnit.size()) as SpeedUnit

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 228 KiB

View File

@@ -3,8 +3,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://deeixbwehify0"
path.s3tc="res://.godot/imported/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.ctex"
path.etc2="res://.godot/imported/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.ctex"
path.s3tc="res://.godot/imported/cement.png-ce0aa9838dd9c502970938c3444abe0d.s3tc.ctex"
path.etc2="res://.godot/imported/cement.png-ce0aa9838dd9c502970938c3444abe0d.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
@@ -12,8 +12,8 @@ metadata={
[deps]
source_file="res://Images/cement.png"
dest_files=["res://.godot/imported/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.ctex", "res://.godot/imported/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.ctex"]
source_file="res://textures/cement.png"
dest_files=["res://.godot/imported/cement.png-ce0aa9838dd9c502970938c3444abe0d.s3tc.ctex", "res://.godot/imported/cement.png-ce0aa9838dd9c502970938c3444abe0d.etc2.ctex"]
[params]
@@ -31,5 +31,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://de7itkxhl0u28"
path="res://.godot/imported/choose_tow.png-44e07473d53f066833ce9f8293b279c2.ctex"
path="res://.godot/imported/choose_tow.png-98497909563147058e33250f8d1683f4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/choose_tow.png"
dest_files=["res://.godot/imported/choose_tow.png-44e07473d53f066833ce9f8293b279c2.ctex"]
source_file="res://textures/choose_tow.png"
dest_files=["res://.godot/imported/choose_tow.png-98497909563147058e33250f8d1683f4.ctex"]
[params]
@@ -29,5 +29,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://hvkcmpdq1t0k"
path="res://.godot/imported/choose_trailer.png-655ee091ac0a8e8db872e684d92af7c9.ctex"
path="res://.godot/imported/choose_trailer.png-fd19a6a0470bf156ff533b17c220bb25.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/choose_trailer.png"
dest_files=["res://.godot/imported/choose_trailer.png-655ee091ac0a8e8db872e684d92af7c9.ctex"]
source_file="res://textures/choose_trailer.png"
dest_files=["res://.godot/imported/choose_trailer.png-fd19a6a0470bf156ff533b17c220bb25.ctex"]
[params]
@@ -29,5 +29,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bh7b4n4lg1uqt"
path="res://.godot/imported/choose_van.png-7feae3acf1caead6dd28bf86a912e079.ctex"
path="res://.godot/imported/choose_van.png-bf155c126082baee803c63d2d237b1d3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images/choose_van.png"
dest_files=["res://.godot/imported/choose_van.png-7feae3acf1caead6dd28bf86a912e079.ctex"]
source_file="res://textures/choose_van.png"
dest_files=["res://.godot/imported/choose_van.png-bf155c126082baee803c63d2d237b1d3.ctex"]
[params]
@@ -29,5 +29,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 326 KiB

View File

@@ -3,8 +3,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cltpie6eq33br"
path.s3tc="res://.godot/imported/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.ctex"
path.etc2="res://.godot/imported/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.ctex"
path.s3tc="res://.godot/imported/grass.png-c637977c146fec1b1e97e5c999cb4594.s3tc.ctex"
path.etc2="res://.godot/imported/grass.png-c637977c146fec1b1e97e5c999cb4594.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
@@ -12,8 +12,8 @@ metadata={
[deps]
source_file="res://Images/grass.png"
dest_files=["res://.godot/imported/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.ctex", "res://.godot/imported/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.ctex"]
source_file="res://textures/grass.png"
dest_files=["res://.godot/imported/grass.png-c637977c146fec1b1e97e5c999cb4594.s3tc.ctex", "res://.godot/imported/grass.png-c637977c146fec1b1e97e5c999cb4594.etc2.ctex"]
[params]
@@ -31,5 +31,6 @@ process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -0,0 +1,36 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://q7uvsiqefkwr"
path.s3tc="res://.godot/imported/truck_trailer.png-1c486d64b51a1c6bf88af1f04ce48ecf.s3tc.ctex"
path.etc2="res://.godot/imported/truck_trailer.png-1c486d64b51a1c6bf88af1f04ce48ecf.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}
[deps]
source_file="res://textures/truck_trailer.png"
dest_files=["res://.godot/imported/truck_trailer.png-1c486d64b51a1c6bf88af1f04ce48ecf.s3tc.ctex", "res://.godot/imported/truck_trailer.png-1c486d64b51a1c6bf88af1f04ce48ecf.etc2.ctex"]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,52 +1,40 @@
[gd_scene load_steps=8 format=3 uid="uid://cowqwuqos6m0q"]
[gd_scene load_steps=6 format=3 uid="uid://b0036qgpepmwc"]
[ext_resource type="PackedScene" uid="uid://dom2qigc1hn32" path="res://town_mesh.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://2lbu3a1dk0a5" path="res://truck_town.glb" id="1_x0dmm"]
[ext_resource type="Script" path="res://spedometer.gd" id="2"]
[ext_resource type="Environment" uid="uid://cuvs67826w51u" path="res://default_env.tres" id="3_t0mbp"]
[sub_resource type="StyleBoxEmpty" id="1"]
[sub_resource type="Theme" id="2"]
Button/styles/focus = SubResource( "1" )
[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" )
[sub_resource type="Environment" id="Environment_f4cvs"]
background_mode = 2
sky = SubResource( "Sky_1gf0c" )
tonemap_mode = 2
glow_enabled = true
Button/styles/focus = SubResource("1")
[node name="TownScene" type="Node3D"]
[node name="TownMesh" parent="." instance=ExtResource( "1" )]
[node name="TruckTown" parent="." instance=ExtResource("1_x0dmm")]
[node name="InstancePos" type="Position3D" parent="."]
[node name="InstancePos" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.2039, 6.67095, -37.6042)
[node name="Panel" type="Panel" parent="InstancePos"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -130.0
offset_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
grow_horizontal = 0
[node name="Spedometer" type="Button" parent="InstancePos/Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
theme = SubResource( "2" )
grow_horizontal = 2
grow_vertical = 2
theme = SubResource("2")
text = "Speed: ???"
flat = true
script = ExtResource( "2" )
__meta__ = {
"_edit_use_anchors_": false
}
script = ExtResource("2")
[node name="Back" type="Button" parent="."]
offset_left = 17.0
@@ -56,10 +44,10 @@ offset_bottom = 41.0
text = "<- Back!"
[node name="Environment" type="WorldEnvironment" parent="."]
environment = SubResource( "Environment_f4cvs" )
environment = ExtResource("3_t0mbp")
[node name="Sun" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -0.629475, 0.777021, 0, -0.777021, -0.629475, 0, 24.4076, 0)
transform = Transform3D(0.939693, -0.280167, -0.196175, -5.01437e-08, -0.573577, 0.819152, -0.34202, -0.769751, -0.538986, 0, 24.4076, 0)
shadow_enabled = true
[connection signal="pressed" from="InstancePos/Panel/Spedometer" to="InstancePos/Panel/Spedometer" method="_on_Spedometer_pressed"]
[connection signal="pressed" from="InstancePos/Panel/Spedometer" to="InstancePos/Panel/Spedometer" method="_on_spedometer_pressed"]

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -0,0 +1,91 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://2lbu3a1dk0a5"
path="res://.godot/imported/truck_town.glb-b721f5a7e8588ad7f9f8190f99e67720.scn"
[deps]
source_file="res://truck_town.glb"
dest_files=["res://.godot/imported/truck_town.glb-b721f5a7e8588ad7f9f8190f99e67720.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="TruckTown"
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=false
animation/import=false
animation/fps=30
import_script/path=""
_subresources={
"materials": {
"grass": {
"use_external/enabled": true,
"use_external/path": "res://materials/grass.tres"
},
"road": {
"use_external/enabled": true,
"use_external/path": "res://materials/cement.tres"
}
},
"nodes": {
"PATH:Grass": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House01": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House02": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House03": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House04": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House05": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House06": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House07": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House08": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House09": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:House10": {
"generate/physics": true,
"physics/shape_type": 2
},
"PATH:Road": {
"decomposition/advanced": true,
"decomposition/precision": 10,
"generate/physics": true,
"physics/shape_type": 2
}
}
}

View File

@@ -3,37 +3,37 @@ extends VehicleBody3D
const STEER_SPEED = 1.5
const STEER_LIMIT = 0.4
var steer_target = 0
@export var engine_force_value := 40.0
@export var engine_force_value = 40
var _steer_target := 0.0
func _physics_process(delta):
var fwd_mps = (linear_velocity * transform.basis).x
func _physics_process(delta: float):
var fwd_mps := (linear_velocity * transform.basis).x
steer_target = Input.get_axis(&"turn_right", &"turn_left")
steer_target *= STEER_LIMIT
_steer_target = Input.get_axis(&"turn_right", &"turn_left")
_steer_target *= STEER_LIMIT
if Input.is_action_pressed(&"accelerate"):
# Increase engine force at low speeds to make the initial acceleration faster.
var speed = linear_velocity.length()
if speed < 5 and speed != 0:
engine_force = clamp(engine_force_value * 5 / speed, 0, 100)
var speed := linear_velocity.length()
if speed < 5.0 and not is_zero_approx(speed):
engine_force = clampf(engine_force_value * 5.0 / speed, 0.0, 100.0)
else:
engine_force = engine_force_value
else:
engine_force = 0
engine_force = 0.0
if Input.is_action_pressed(&"reverse"):
# Increase engine force at low speeds to make the initial acceleration faster.
if fwd_mps >= -1:
var speed = linear_velocity.length()
if speed < 5 and speed != 0:
engine_force = -clamp(engine_force_value * 5 / speed, 0, 100)
if fwd_mps >= -1.0:
var speed := linear_velocity.length()
if speed < 5.0 and not is_zero_approx(speed):
engine_force = -clampf(engine_force_value * 5.0 / speed, 0.0, 100.0)
else:
engine_force = -engine_force_value
else:
brake = 1
brake = 1.0
else:
brake = 0.0
steering = move_toward(steering, steer_target, STEER_SPEED * delta)
steering = move_toward(steering, _steer_target, STEER_SPEED * delta)