First Commit

This commit is contained in:
reo 2025-03-09 17:41:31 +03:00
commit f6680e7028
27 changed files with 513 additions and 0 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
/android/

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"godotTools.editorPath.godot4": "c:\\Users\\reo\\Documents\\Godot_v4.4-stable_win64.exe\\Godot_v4.4-stable_win64.exe"
}

3
README.md Normal file
View file

@ -0,0 +1,3 @@
## Attributions
- `car.glb` https://poly.pizza/m/bTcqWpYqeeM

BIN
blender/road.blend Normal file

Binary file not shown.

53
blender/road.blend.import Normal file
View file

@ -0,0 +1,53 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://djnnc1func8ov"
path="res://.godot/imported/road.blend-d96fc24a97868e869bb1ef065ebc0500.scn"
[deps]
source_file="res://blender/road.blend"
dest_files=["res://.godot/imported/road.blend-d96fc24a97868e869bb1ef065ebc0500.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

BIN
blender/road.blend1 Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -0,0 +1,38 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqxe26l0r51wq"
path.s3tc="res://.godot/imported/road_black+asphalt-1024x1024.png-1307df15a9c010b2952bf8215c8259ee.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "46d8607f4abdf9ddafee380e7cc7ef7f"
}
[deps]
source_file="res://blender/road_black+asphalt-1024x1024.png"
dest_files=["res://.godot/imported/road_black+asphalt-1024x1024.png-1307df15a9c010b2952bf8215c8259ee.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
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

BIN
blender/testcar.blend Normal file

Binary file not shown.

View file

@ -0,0 +1,53 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://xhafneumvp3v"
path="res://.godot/imported/testcar.blend-5bb148cb5fd3633f9870b48f33fb40c3.scn"
[deps]
source_file="res://blender/testcar.blend"
dest_files=["res://.godot/imported/testcar.blend-5bb148cb5fd3633f9870b48f33fb40c3.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

BIN
blender/testcar.blend1 Normal file

Binary file not shown.

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bntyanq8h1m83"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

BIN
objects/car.glb Normal file

Binary file not shown.

37
objects/car.glb.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://id7a7h1kqg5i"
path="res://.godot/imported/car.glb-ba9078b939259f9fa9f8d85e8e808331.scn"
[deps]
source_file="res://objects/car.glb"
dest_files=["res://.godot/imported/car.glb-ba9078b939259f9fa9f8d85e8e808331.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

BIN
objects/road.glb Normal file

Binary file not shown.

37
objects/road.glb.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dtncvl5af4fhr"
path="res://.godot/imported/road.glb-7d2d207f0f9e5aefac026f0652babcde.scn"
[deps]
source_file="res://objects/road.glb"
dest_files=["res://.godot/imported/road.glb-7d2d207f0f9e5aefac026f0652babcde.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -0,0 +1,38 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3rwrqukc80ya"
path.s3tc="res://.godot/imported/road_black+asphalt-1024x1024.png-71be97b5c88f72c8778636d7ec81f52b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "46d8607f4abdf9ddafee380e7cc7ef7f"
}
[deps]
source_file="res://objects/road_black+asphalt-1024x1024.png"
dest_files=["res://.godot/imported/road_black+asphalt-1024x1024.png-71be97b5c88f72c8778636d7ec81f52b.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
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

BIN
objects/testcar.glb Normal file

Binary file not shown.

View file

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cewenjpq8wbig"
path="res://.godot/imported/testcar.glb-d38a97ba5df69ac8ff5b131d7c021655.scn"
[deps]
source_file="res://objects/testcar.glb"
dest_files=["res://.godot/imported/testcar.glb-d38a97ba5df69ac8ff5b131d7c021655.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

46
project.godot Normal file
View file

@ -0,0 +1,46 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="3D Truck Driver"
run/main_scene="uid://d4ljkc7l57udr"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1280
window/size/viewport_height=960
window/size/resizable=false
window/stretch/mode="viewport"
[input]
move_forward={
"deadzone": 0.2,
"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":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
move_backward={
"deadzone": 0.2,
"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":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
turn_right={
"deadzone": 0.2,
"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":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
turn_left={
"deadzone": 0.2,
"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":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}

80
scenes/game.tscn Normal file
View file

@ -0,0 +1,80 @@
[gd_scene load_steps=8 format=3 uid="uid://d4ljkc7l57udr"]
[ext_resource type="PackedScene" uid="uid://dtncvl5af4fhr" path="res://objects/road.glb" id="1_uwrxv"]
[ext_resource type="Script" uid="uid://cs0y5pe8qnj2r" path="res://scripts/player.gd" id="2_lnu2h"]
[ext_resource type="PackedScene" uid="uid://cewenjpq8wbig" path="res://objects/testcar.glb" id="2_yqjtg"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_lnu2h"]
sky_top_color = Color(0, 0.388235, 1, 1)
sky_horizon_color = Color(0.485671, 0.57498, 0.718921, 1)
ground_horizon_color = Color(0.485671, 0.57498, 0.718921, 1)
[sub_resource type="Sky" id="Sky_lbhrr"]
sky_material = SubResource("ProceduralSkyMaterial_lnu2h")
[sub_resource type="Environment" id="Environment_iywne"]
background_mode = 2
sky = SubResource("Sky_lbhrr")
tonemap_mode = 2
glow_enabled = true
[sub_resource type="BoxShape3D" id="BoxShape3D_yqjtg"]
size = Vector3(3.60051, 2.21851, 1.87103)
[node name="Game" type="Node3D"]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_iywne")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
[node name="RoadBlocks" type="Node3D" parent="."]
[node name="Road" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -10.549, 9.53674e-07, 0.0019331)
[node name="Road2" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 9.5, 0, 0)
[node name="Road3" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -50.613, 9.53674e-07, 0.0019331)
[node name="Road4" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -30.564, 0, 0)
[node name="Road5" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -89.5907, 9.53674e-07, 0.0019331)
[node name="Road6" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -69.5417, 0, 0)
[node name="Road7" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -129.655, 9.53674e-07, 0.0019331)
[node name="Road8" parent="RoadBlocks" instance=ExtResource("1_uwrxv")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -109.606, 0, 0)
[node name="Player" type="CharacterBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.449395)
script = ExtResource("2_lnu2h")
[node name="TestCar" parent="Player" instance=ExtResource("2_yqjtg")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.53674e-07, -0.463639)
[node name="FrontLeftWheel" type="Node3D" parent="Player/TestCar"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.8, 0.3, 1.2)
[node name="FrontRightWheel" type="Node3D" parent="Player/TestCar"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.8, 0.3, 1.2)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.279745, 1.10964, -0.462006)
shape = SubResource("BoxShape3D_yqjtg")
[node name="Head" type="Node3D" parent="Player"]
transform = Transform3D(0.965536, 0.260269, 0, -0.260269, 0.965536, 0, 0, 0, 1, 0, 1.54334, -0.215674)
[node name="Camera3D" type="Camera3D" parent="Player/Head"]
transform = Transform3D(-4.25071e-08, -0.233123, 0.972448, -1.01901e-08, 0.972448, 0.233123, -1, 5.4623e-14, -4.37115e-08, -0.136201, -0.0638226, 0.247312)

40
scripts/player.gd Normal file
View file

@ -0,0 +1,40 @@
extends CharacterBody3D
@export var acceleration: float = 10.0
@export var brake_intensity: float = 5.0
@export var rotation_speed: float = 1.5
@export var gravity: float = 9.8
@export var max_speed: float = 30.0
var current_speed: float = 0.0
func _physics_process(delta: float) -> void:
# Apply gravity
if not is_on_floor():
velocity.y -= gravity * delta
# Get input direction
var input_forward = Input.get_action_strength("move_forward") - Input.get_action_strength("move_backward")
var input_rotation = Input.get_action_strength("turn_right") - Input.get_action_strength("turn_left")
# Handle rotation
if input_rotation != 0:
rotate_y(-input_rotation * rotation_speed * delta)
# Handle acceleration and braking
if input_forward > 0:
# Accelerate forward
current_speed = move_toward(current_speed, max_speed, acceleration * delta)
elif input_forward < 0:
# Accelerate backward
current_speed = move_toward(current_speed, -max_speed / 2, acceleration * delta)
else:
# No input, gradually slow down
current_speed = move_toward(current_speed, 0, brake_intensity * delta)
# Apply movement in the direction the vehicle is facing
var direction = -global_transform.basis.z
velocity.z = direction.x * current_speed
velocity.x = direction.z * current_speed
move_and_slide()

1
scripts/player.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cs0y5pe8qnj2r