From 814e50a86283d3de0adeeda06e89565a302af5d1 Mon Sep 17 00:00:00 2001 From: Crizomb <62544756+Crizomb@users.noreply.github.com> Date: Sat, 2 Aug 2025 15:21:08 +0200 Subject: [PATCH] init --- .editorconfig | 4 ++++ .gitattributes | 2 ++ .gitignore | 3 +++ entities/RoadPath.tscn | 14 ++++++++++++++ entities/do_spline.gd | 26 ++++++++++++++++++++++++++ entities/do_spline.gd.uid | 1 + icon.svg | 1 + icon.svg.import | 37 +++++++++++++++++++++++++++++++++++++ project.godot | 20 ++++++++++++++++++++ scenes/main.tscn | 3 +++ 10 files changed, 111 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 entities/RoadPath.tscn create mode 100644 entities/do_spline.gd create mode 100644 entities/do_spline.gd.uid create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 project.godot create mode 100644 scenes/main.tscn diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/entities/RoadPath.tscn b/entities/RoadPath.tscn new file mode 100644 index 0000000..9d6081f --- /dev/null +++ b/entities/RoadPath.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://cjk3phtyyiyty"] + +[ext_resource type="Script" uid="uid://bdw7xdf1lc3ud" path="res://entities/do_spline.gd" id="1_c4y0q"] + +[sub_resource type="Curve3D" id="Curve3D_p7e7j"] +_data = { +"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.24595, 0, 10), +"tilts": PackedFloat32Array(0, 0) +} +point_count = 2 + +[node name="Track" type="Path3D"] +curve = SubResource("Curve3D_p7e7j") +script = ExtResource("1_c4y0q") diff --git a/entities/do_spline.gd b/entities/do_spline.gd new file mode 100644 index 0000000..506b783 --- /dev/null +++ b/entities/do_spline.gd @@ -0,0 +1,26 @@ +@tool +extends Path3D +class_name RoadPath +@export_tool_button("update_control_points") var action = update_control_points + +func update_control_points(): + if curve.point_count < 2: + return + + + # Start point: out control based on next point + var dir = (curve.get_point_position(1) - curve.get_point_position(0)).normalized() + var tangent_length = dir.length() / 3 + + curve.set_point_out(0, dir * tangent_length) + + # Intermediate points: in and out controls based on adjacent points + for i in range(1, curve.point_count - 1): + var prev_dir = (curve.get_point_position(i) - curve.get_point_position(i - 1)).normalized() + var next_dir = (curve.get_point_position(i + 1) - curve.get_point_position(i)).normalized() + tangent_length = next_dir.length() / 3 + var tangent = (prev_dir + next_dir) + tangent.y = 0 + tangent = tangent.normalized() + curve.set_point_in(i, -tangent * tangent_length) + curve.set_point_out(i, tangent * tangent_length) diff --git a/entities/do_spline.gd.uid b/entities/do_spline.gd.uid new file mode 100644 index 0000000..3017618 --- /dev/null +++ b/entities/do_spline.gd.uid @@ -0,0 +1 @@ +uid://bdw7xdf1lc3ud diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..9d8b7fa --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..1320004 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c32mxwui4br07" +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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..a6eb5a4 --- /dev/null +++ b/project.godot @@ -0,0 +1,20 @@ +; 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="Looping" +config/features=PackedStringArray("4.4", "GL Compatibility") +config/icon="res://icon.svg" + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/scenes/main.tscn b/scenes/main.tscn new file mode 100644 index 0000000..ffb66f8 --- /dev/null +++ b/scenes/main.tscn @@ -0,0 +1,3 @@ +[gd_scene format=3 uid="uid://bd8skoxlvujam"] + +[node name="Main" type="Node3D"]