From 40cadd2f73d272003154f3471ae17b4be448c74a Mon Sep 17 00:00:00 2001 From: Overside srl Date: Sun, 1 Feb 2026 09:53:24 +0100 Subject: [PATCH 1/2] switch --- .godot/editor/create_recent.Node | 10 +- .godot/editor/editor_layout.cfg | 26 +++-- .godot/editor/editor_script_doc_cache.res | Bin 0 -> 6243 bytes .godot/editor/filesystem_cache10 | 18 ++-- .godot/editor/filesystem_update4 | 1 - .godot/editor/project_metadata.cfg | 4 +- ...lding-8e4deca5ebc583cb0317bfa5f2843afb.cfg | 3 + ...lding-66615c4df519abfd9e79d3c9f0c4dc07.cfg | 3 + .godot/editor/script_editor_cache.cfg | 50 +++++++-- ...state-b7c23acdb9e1e98235fe339237e8146e.cfg | 14 +-- ...lding-b7c23acdb9e1e98235fe339237e8146e.cfg | 4 +- .godot/global_script_class_cache.cfg | 68 ++++++------ .godot/uid_cache.bin | Bin 7947 -> 8027 bytes scenes/train_control.tscn | 102 +++++++++++++++--- scripts/engine.gd | 16 +-- scripts/rail_switch.gd | 17 +++ scripts/rail_switch.gd.uid | 1 + scripts/rail_swtich.gd | 14 +++ scripts/rail_swtich.gd.uid | 1 + scripts/train_movement.gd | 40 +++++++ scripts/traincontrol.gd | 6 +- 21 files changed, 300 insertions(+), 98 deletions(-) create mode 100644 .godot/editor/editor_script_doc_cache.res delete mode 100644 .godot/editor/filesystem_update4 create mode 100644 .godot/editor/rail_switch.gd-folding-8e4deca5ebc583cb0317bfa5f2843afb.cfg create mode 100644 .godot/editor/rail_swtich.gd-folding-66615c4df519abfd9e79d3c9f0c4dc07.cfg create mode 100644 scripts/rail_switch.gd create mode 100644 scripts/rail_switch.gd.uid create mode 100644 scripts/rail_swtich.gd create mode 100644 scripts/rail_swtich.gd.uid diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index c5e5018..9ae617e 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,14 +1,14 @@ +Button +Area3D +Node3D Path3D -RemoteTransform3D +CSGPolygon3D PathFollow3D +RemoteTransform3D MeshInstance3D CollisionShape3D RigidBody3D -CSGPolygon3D Label TextureRect Panel VBoxContainer -Button -Control -Node3D diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index e24bbe8..5123816 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -22,7 +22,7 @@ dock_hsplit_1=0 dock_hsplit_2=270 dock_hsplit_3=-270 dock_hsplit_4=0 -dock_9_selected_tab_idx=0 +dock_9_selected_tab_idx=1 dock_3="Scene,Import" dock_4="FileSystem" dock_5="Inspector,History,Signals,Groups" @@ -30,10 +30,10 @@ dock_9="Output,Debugger,Audio,Animation,Shader Editor,Search Results,AnimationTr [EditorNode] -open_scenes=PackedStringArray("res://scenes/main.tscn", "res://scenes/gamestate.tscn") -current_scene="res://scenes/main.tscn" +open_scenes=PackedStringArray("res://scenes/train_control.tscn") +current_scene="res://scenes/train_control.tscn" center_split_offset=-864 -selected_default_debugger_tab_idx=1 +selected_default_debugger_tab_idx=0 selected_main_editor_idx=2 selected_bottom_panel_item=0 bottom_panel_offsets={ @@ -53,8 +53,8 @@ size=Vector2i(4294, 3405) [ScriptEditor] -open_scripts=["res://scripts/engine.gd", "res://scripts/gamestate.gd", "res://scripts/main.gd", "res://scripts/objloader.gd", "res://scripts/scene_switcher.gd", "res://scripts/track_generator.gd", "res://scripts/train.gd", "res://scripts/traincontrol.gd", "res://scripts/traincontrol_camera.gd", "res://scripts/trainjourney.gd", "res://scripts/trainjourney_camera.gd", "res://scripts/train_movement.gd"] -selected_script="res://scripts/main.gd" +open_scripts=["res://scripts/engine.gd", "res://scripts/gamestate.gd", "res://scripts/main.gd", "res://scripts/objloader.gd", "res://scripts/rail_swtich.gd", "res://scripts/scene_switcher.gd", "res://scripts/track_generator.gd", "res://scripts/train.gd", "res://scripts/traincontrol.gd", "res://scripts/traincontrol_camera.gd", "res://scripts/trainjourney.gd", "res://scripts/trainjourney_camera.gd", "res://scripts/train_movement.gd"] +selected_script="res://scripts/train_movement.gd" open_help=[] script_split_offset=400 list_split_offset=0 @@ -79,10 +79,20 @@ v_split_offset=0 display_mode=0 file_sort=0 file_list_display_mode=1 -selected_paths=PackedStringArray("res://scripts/main.gd") -uncollapsed_paths=PackedStringArray("res://", "res://scripts/", "res://resources/train kit/") +selected_paths=PackedStringArray("res://scenes/train_control.tscn") +uncollapsed_paths=PackedStringArray("res://", "res://scripts/", "res://scenes/", "res://resources/train kit/") [docks/History] include_scene=true include_global=true + +[editor_log] + +log_filter_0=true +log_filter_2=true +log_filter_1=true +log_filter_3=true +log_filter_4=true +collapse=false +show_search=true diff --git a/.godot/editor/editor_script_doc_cache.res b/.godot/editor/editor_script_doc_cache.res new file mode 100644 index 0000000000000000000000000000000000000000..9284e45e92562e5765333bfab001a3c4b9041710 GIT binary patch literal 6243 zcmV-p7@X%)Q$s@n000005C8y>c>n;T0{{Ta0ssJ80{{R30{{Td0ssI90{{R+0{{R{ z0ssIgwJ-f(01wR^0ET00IbeyB4loQOhG7_nVHk!1HAS{uImq7Jh$JCI?p^L_Vt;C? zSeVRIqu`7E1)RqE%&?EaH2R-_{1jFIS^!`GuLA64h1_PaM?*UsYLrg{GawNBxA?E% zUo@P;6%4AHhU0&M{|-sQG7W6PiSm;q2=~E39TRxY~Q5PNGr#&1B|d#R?7oq50YR3k!ft0qZD#V1X@Sxamx+juokkevn^u=2&%_O zGCTM`AwqeIP(i?EoHK7qAfWxU5}-S{$KD`nR0ZQ@*hLOuanhj1Pm)VM8YaU zc@7LhICe$5Vo{yZ($Tb|U6#%t06`5^o&@wFKc`>Y$ zD^?S{`gBOxPC1@0-bx6I+Gn~xpYlP2Lydqm5*F$z;|##7_<(c_$@jujV@Q~Cn~e1{ zW;wCt6k1%V8dea6l4;#=I>VLPjpb6f0aiapIAEv?x?EtE9D?KP^$K|;o5Ecu$pPjw zKw3JwaH;U}AdKzcSSuI=AiV{eb%DaPD6S*2rv;v{AXT*^P}|k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?K>4p&LuoO4|J^(xbNnvUx1YG zK%MVD0)TQW^<%7Hf-IR2kdHfLG9mvNC~C9eYCupq{wpMFlzln zAWKJ7daNoKJpwEy?OZRW?4~OLFvm#&d#HiMA(D~Nq=iZcU;>dDs=5ObKm-*^(FhV4 zB3J|xgAfTuL?jxCMq#D{ByhvIx!BiOD^e!EkLw|7_>89y7jS`Y|uf~aLl>56ng*$JV9({@E5D3mUXOnJsY z7CV{M2^MFynNkB`JV+Q_Orbq@(L=0Q??b-339z>1z!F^qWk_qw_noc^eH0ePsahTBJt!b%h2N zLWo+tyMw#b+BZ_qATP>JfPZFHzhaxDC_GFC&P()vR0JrmF^qCS)eC}S3>`-nJl=1$ NQ>o-7Q~^>`Lqqa+TVMbH literal 0 HcmV?d00001 diff --git a/.godot/editor/filesystem_cache10 b/.godot/editor/filesystem_cache10 index 8b12b43..f76f6d5 100644 --- a/.godot/editor/filesystem_cache10 +++ b/.godot/editor/filesystem_cache10 @@ -1,5 +1,5 @@ 63f7b34db8d8cdea90c76aacccf841ec -::res://::1769537417 +::res://::1769935928 export_presets.cfg::TextFile::-1::1768659892::0::1::::<><><>0<>0<><>:: ::res://build/::1769525949 ::res://resources/::1769500126 @@ -114,23 +114,25 @@ train-tram-modern.obj::Mesh::7951114505230208222::1727040295::1768551393::1::::< train-tram-round.obj::Mesh::115250456338501034::1727040295::1768551393::1::::<><><>0<>0<>5e3772ddb59635a364b94e1db000bd4a<>res://.godot/imported/train-tram-round.obj-1b613e087f922f3f788c8bf27b8a5616.mesh<*>res://.godot/imported/train-tram-round.obj-1b613e087f922f3f788c8bf27b8a5616.mesh::uid://cdwwcby54pecs::::res://resources/train kit/Textures/colormap.png ::res://resources/train kit/Textures/::1769067197 colormap.png::CompressedTexture2D::5030163645319353198::1727040840::1768551396::1::::<><><>0<>0<>49486029a612050ab47ae771aec92b8c<>res://.godot/imported/colormap.png-d3d02b00fd834f010bf45b2b9259ea63.s3tc.ctex:: -::res://scenes/::1769537407 +::res://scenes/::1769878170 gamestate.tscn::PackedScene::4137542781585662412::1769537142::0::1::::<><><>0<>0<><>::uid://s80bt8i6u2hv::::res://scripts/gamestate.gd -main.tscn::PackedScene::6062849282872582400::1769537407::0::1::::<><><>0<>0<><>::uid://cfjaa6hq1wpvd::::res://scripts/main.gd +main.tscn::PackedScene::6062849282872582400::1769537468::0::1::::<><><>0<>0<><>::uid://cfjaa6hq1wpvd::::res://scripts/main.gd musicmanager.tscn::PackedScene::1158465914396145662::1769536753::0::1::::<><><>0<>0<><>::uid://bdluyy5uodjb5::::res://resources/thomastanks_new.mp3 train.tscn::PackedScene::5090417957456705533::1769536752::0::1::::<><><>0<>0<><>:: trainjourney.tscn::PackedScene::7111673961189096216::1769536751::0::1::::<><><>0<>0<><>::uid://dfyo0h5yj3us8::::res://scripts/trainjourney.gd<>uid://csm5ihvpyw5m7::::res://scenes/main.tscn<>uid://bymoo78gun6a4::::res://scripts/track_generator.gd<>uid://cer3o7xlhju7v::::res://scenes/train.tscn<>uid://cvn333pymsowx::::res://scripts/train.gd<>uid://cgy51h6a5syer::::res://scripts/trainjourney_camera.gd<>uid://bi2atrvjj23tk::::res://resources/audio_on.png<>uid://qrf08uiuhyqg::::res://scenes/musicmanager.tscn<>uid://n6bjl02ikh00::::res://resources/audio_off.png<>uid://by7iywhy2d8uy::::res://scenes/gamestate.tscn -train_control.tscn::PackedScene::7634187837543058913::1769536757::0::1::::<><><>0<>0<><>::uid://ckndmko4orxx::::res://scripts/traincontrol.gd<>uid://bg24v3kb5e73l::::res://resources/rail2.png<>uid://csm5ihvpyw5m7::::res://scenes/main.tscn<>uid://ck4j0pekoofm1::::res://scripts/engine.gd<>uid://cm8un80nubjbi::::res://resources/train kit/train-diesel-a.obj<>uid://b65vwus8xxmun::::res://scripts/traincontrol_camera.gd<>uid://df2oi5vyeak81::::res://scripts/train_movement.gd -::res://scripts/::1769537142 -engine.gd::GDScript::5535188650919869270::1769520398::0::1::::TrainEngine<>PathFollow3D<><>0<>0<><>:: +train_control.tscn::PackedScene::7634187837543058913::1769878170::0::1::::<><><>0<>0<><>::uid://ckndmko4orxx::::res://scripts/traincontrol.gd<>uid://bg24v3kb5e73l::::res://resources/rail2.png<>uid://csm5ihvpyw5m7::::res://scenes/main.tscn<>uid://ck4j0pekoofm1::::res://scripts/engine.gd<>uid://cm8un80nubjbi::::res://resources/train kit/train-diesel-a.obj<>uid://b65vwus8xxmun::::res://scripts/traincontrol_camera.gd<>uid://df2oi5vyeak81::::res://scripts/train_movement.gd<>uid://b5x80gpkn1swt::::res://scripts/rail_swtich.gd +::res://scripts/::1769878171 +engine.gd::GDScript::5535188650919869270::1769877447::0::1::::<>PathFollow3D<><>0<>0<><>:: gamestate.gd::GDScript::1333044411309547839::1769079115::0::1::::<>Node<><>0<>0<><>:: main.gd::GDScript::5142366625162981657::1769537142::0::1::::<>Control<><>0<>0<><>:: objloader.gd::GDScript::2596173299165953535::1768586602::0::1::::OBJLoader<>RefCounted<><>0<>0<><>:: +rail_switch.gd::GDScript::84664361793048242::1769876403::0::1::::RailSwitch<>Area3D<><>0<>0<><>:: +rail_swtich.gd::GDScript::4541615325571300327::1769877343::0::1::::<>Area3D<><>0<>0<><>:: scene_switcher.gd::GDScript::9078813208397392183::1769536784::0::1::::<>Node<><>0<>0<><>:: track_generator.gd::GDScript::4096602235093631041::1768587411::0::1::::TrackGenerator<>Node3D<><>0<>0<><>:: train.gd::GDScript::6275395567547538251::1769079965::0::1::::Train<>Node3D<><>0<>0<><>:: -traincontrol.gd::GDScript::161816789508007529::1769520732::0::1::::<>Node3D<><>0<>0<><>:: +traincontrol.gd::GDScript::161816789508007529::1769878171::0::1::::<>Node3D<><>0<>0<><>:: traincontrol_camera.gd::GDScript::4625521593212407341::1769519796::0::1::::TrainControlCamera<>Camera3D<><>0<>0<><>:: trainjourney.gd::GDScript::7560646433224437573::1769519382::0::1::::<>Node3D<><>0<>0<><>:: trainjourney_camera.gd::GDScript::5245387851329565609::1769519365::0::1::::TrainJourneyCamera<>Camera3D<><>0<>0<><>:: -train_movement.gd::GDScript::7566810402116253988::1769521010::0::1::::<>MeshInstance3D<><>0<>0<><>:: +train_movement.gd::GDScript::7566810402116253988::1769878156::0::1::::TrainBody<>MeshInstance3D<><>0<>0<><>:: diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 deleted file mode 100644 index 14e1d06..0000000 --- a/.godot/editor/filesystem_update4 +++ /dev/null @@ -1 +0,0 @@ -res://scenes/main.tscn diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 03486fc..2c6b547 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -10,8 +10,8 @@ use_advanced_connections=false [recent_files] -scenes=["res://scenes/gamestate.tscn", "res://scenes/main.tscn", "res://scenes/train_control.tscn", "res://scenes/musicmanager.tscn", "res://scenes/train.tscn", "res://scenes/trainjourney.tscn", "res://scenes/game_state.tscn", "res://scenes/wagon.tscn"] -scripts=["res://scripts/main.gd", "res://scripts/scene_switcher.gd", "res://scripts/objloader.gd", "res://scripts/traincontrol.gd", "res://scripts/traincontrol_camera.gd", "res://scripts/train_movement.gd", "res://scripts/engine.gd", "res://scripts/trainjourney_camera.gd", "res://scripts/train.gd", "res://scripts/track_generator.gd"] +scenes=["res://scenes/train_control.tscn", "res://scenes/main.tscn", "res://scenes/gamestate.tscn", "res://scenes/musicmanager.tscn", "res://scenes/train.tscn", "res://scenes/trainjourney.tscn", "res://scenes/game_state.tscn", "res://scenes/wagon.tscn"] +scripts=["res://scripts/rail_swtich.gd", "res://scripts/rail_switch.gd", "res://scripts/main.gd", "res://scripts/scene_switcher.gd", "res://scripts/objloader.gd", "res://scripts/traincontrol.gd", "res://scripts/traincontrol_camera.gd", "res://scripts/train_movement.gd", "res://scripts/engine.gd", "res://scripts/trainjourney_camera.gd"] [dialog_bounds] diff --git a/.godot/editor/rail_switch.gd-folding-8e4deca5ebc583cb0317bfa5f2843afb.cfg b/.godot/editor/rail_switch.gd-folding-8e4deca5ebc583cb0317bfa5f2843afb.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/rail_switch.gd-folding-8e4deca5ebc583cb0317bfa5f2843afb.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/rail_swtich.gd-folding-66615c4df519abfd9e79d3c9f0c4dc07.cfg b/.godot/editor/rail_swtich.gd-folding-66615c4df519abfd9e79d3c9f0c4dc07.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/rail_swtich.gd-folding-66615c4df519abfd9e79d3c9f0c4dc07.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 2d06f21..25038d3 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -21,7 +21,7 @@ state={ "folded_lines": PackedInt32Array(), "h_scroll_position": 0, "row": 131, -"scroll_position": 102.0, +"scroll_position": 0.0, "selection": true, "selection_from_column": 1, "selection_from_line": 131, @@ -67,7 +67,7 @@ state={ "folded_lines": PackedInt32Array(), "h_scroll_position": 0, "row": 33, -"scroll_position": 4.0, +"scroll_position": 15.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -105,10 +105,10 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 29, +"column": 50, "folded_lines": PackedInt32Array(), "h_scroll_position": 0, -"row": 9, +"row": 5, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -123,7 +123,7 @@ state={ "folded_lines": PackedInt32Array(), "h_scroll_position": 0, "row": 52, -"scroll_position": 23.0, +"scroll_position": 30.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -132,12 +132,12 @@ state={ state={ "bookmarks": PackedInt32Array(), -"breakpoints": PackedInt32Array(), -"column": 0, +"breakpoints": PackedInt32Array(25), +"column": 22, "folded_lines": PackedInt32Array(), "h_scroll_position": 0, -"row": 15, -"scroll_position": 0.0, +"row": 18, +"scroll_position": 16.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -175,10 +175,38 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 1, +"column": 0, "folded_lines": PackedInt32Array(), "h_scroll_position": 0, -"row": 7, +"row": 11, +"scroll_position": 11.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/rail_switch.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": PackedInt32Array(), +"h_scroll_position": 0, +"row": 0, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/rail_swtich.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 18, +"folded_lines": PackedInt32Array(), +"h_scroll_position": 0, +"row": 8, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" diff --git a/.godot/editor/train_control.tscn-editstate-b7c23acdb9e1e98235fe339237e8146e.cfg b/.godot/editor/train_control.tscn-editstate-b7c23acdb9e1e98235fe339237e8146e.cfg index 1820727..fd6fcbd 100644 --- a/.godot/editor/train_control.tscn-editstate-b7c23acdb9e1e98235fe339237e8146e.cfg +++ b/.godot/editor/train_control.tscn-editstate-b7c23acdb9e1e98235fe339237e8146e.cfg @@ -5,7 +5,7 @@ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-927.8054, -93.71013), +"ofs": Vector2(-247.07657, 26.025288), "primary_grid_step": Vector2i(8, 8), "show_group_gizmos": true, "show_guides": true, @@ -31,7 +31,7 @@ "snap_rotation_step": 0.2617994, "snap_scale": false, "snap_scale_step": 0.1, -"zoom": 1.1 +"zoom": 1.6105102 } 3D={ "fov": 70.01, @@ -103,7 +103,7 @@ "auto_orthogonal_enabled": true, "cinematic_preview": false, "display_mode": 22, -"distance": 73.97322, +"distance": 11.794629, "doppler": false, "frame_time": false, "gizmos": true, @@ -113,12 +113,12 @@ "listener": true, "lock_rotation": false, "orthogonal": false, -"position": Vector3(0, 0, 0), +"position": Vector3(18.173706, 3.0913553, 48.05532), "transform_gizmo": true, "use_environment": false, "view_type": 0, -"x_rotation": 1.4740068, -"y_rotation": 1.8626451e-08 +"x_rotation": 0.34826988, +"y_rotation": -0.97738516 }, { "auto_orthogonal": false, "auto_orthogonal_enabled": true, @@ -189,4 +189,4 @@ Anim={ "visible": false } -selected_nodes=Array[NodePath]([]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@18065/@Panel@14/@VBoxContainer@15/DockHSplitMain/@VBoxContainer@28/DockVSplitCenter/@VSplitContainer@70/@VBoxContainer@71/@EditorMainScreen@125/MainScreen/@CanvasItemEditor@9318/@VSplitContainer@9101/@HSplitContainer@9103/@HSplitContainer@9105/@Control@9106/@SubViewportContainer@9107/@SubViewport@9108/TrainControl/Ground/Train")]) diff --git a/.godot/editor/train_control.tscn-folding-b7c23acdb9e1e98235fe339237e8146e.cfg b/.godot/editor/train_control.tscn-folding-b7c23acdb9e1e98235fe339237e8146e.cfg index e2d65a2..3206f07 100644 --- a/.godot/editor/train_control.tscn-folding-b7c23acdb9e1e98235fe339237e8146e.cfg +++ b/.godot/editor/train_control.tscn-folding-b7c23acdb9e1e98235fe339237e8146e.cfg @@ -1,5 +1,5 @@ [folding] -node_unfolds=[NodePath("Ground"), PackedStringArray("Transform", "surface_material_override", "surface_material_override/0", "mesh"), NodePath("Ground/Rails"), PackedStringArray("Transform", "Debug Shape", "curve"), NodePath("Ground/Rails/Ballast"), PackedStringArray("Transform", "Geometry"), NodePath("Ground/Rails/LRail"), PackedStringArray("polygon", "Transform"), NodePath("Ground/Rails/RRail"), PackedStringArray("Transform", "polygon"), NodePath("Ground/Rails/TrainEngine"), PackedStringArray("Transform"), NodePath("Ground/Rails/TrainEngine/Train"), PackedStringArray("Skeleton", "Geometry", "Transform"), NodePath("DirectionalLight3D"), PackedStringArray("Light", "Shadow"), NodePath("WorldEnvironment"), PackedStringArray("environment"), NodePath("TrainCamera"), PackedStringArray("Transform")] -resource_unfolds=["res://scenes/train_control.tscn::PlaneMesh_23vqf", PackedStringArray(), "res://scenes/train_control.tscn::StandardMaterial3D_23vqf", PackedStringArray("Albedo"), "res://scenes/train_control.tscn::Curve3D_0b1nv", PackedStringArray("Up Vector", "point_count_array"), "res://scenes/train_control.tscn::StandardMaterial3D_ke0jj", PackedStringArray("UV1", "Transform"), "res://scenes/train_control.tscn::StandardMaterial3D_ihlg3", PackedStringArray("Roughness", "Metallic"), "res://scenes/train_control.tscn::Environment_jy5c4", PackedStringArray("Sky", "Ambient Light", "Fog", "Background"), "res://scenes/train_control.tscn::LabelSettings_1lqs8", PackedStringArray()] +node_unfolds=[NodePath("Ground"), PackedStringArray("Transform", "surface_material_override", "surface_material_override/0", "mesh"), NodePath("Ground/Train"), PackedStringArray("Skeleton", "Geometry", "Transform", "Train"), NodePath("Ground/Rails1"), PackedStringArray("Transform", "Debug Shape", "curve"), NodePath("Ground/Rails1/Ballast"), PackedStringArray("Transform", "Geometry"), NodePath("Ground/Rails1/LRail"), PackedStringArray("polygon", "Transform"), NodePath("Ground/Rails1/RRail"), PackedStringArray("Transform", "polygon"), NodePath("Ground/Rails1/TrainEngine"), PackedStringArray("Transform"), NodePath("DirectionalLight3D"), PackedStringArray("Light", "Shadow"), NodePath("WorldEnvironment"), PackedStringArray("environment"), NodePath("TrainCamera"), PackedStringArray("Transform", "Camera")] +resource_unfolds=["res://scenes/train_control.tscn::PlaneMesh_23vqf", PackedStringArray(), "res://scenes/train_control.tscn::StandardMaterial3D_23vqf", PackedStringArray("Albedo"), "res://scenes/train_control.tscn::Curve3D_0b1nv", PackedStringArray("Up Vector"), "res://scenes/train_control.tscn::StandardMaterial3D_ke0jj", PackedStringArray("UV1", "Transform"), "res://scenes/train_control.tscn::StandardMaterial3D_ihlg3", PackedStringArray("Roughness", "Metallic"), "res://scenes/train_control.tscn::Curve3D_1lqs8", PackedStringArray(), "res://scenes/train_control.tscn::Environment_jy5c4", PackedStringArray("Sky", "Ambient Light", "Fog", "Background"), "res://scenes/train_control.tscn::LabelSettings_1lqs8", PackedStringArray()] nodes_folded=[] diff --git a/.godot/global_script_class_cache.cfg b/.godot/global_script_class_cache.cfg index 08d67b1..4f0bff2 100644 --- a/.godot/global_script_class_cache.cfg +++ b/.godot/global_script_class_cache.cfg @@ -1,35 +1,11 @@ list=[{ -"base": &"Camera3D", -"class": &"TrainJourneyCamera", +"base": &"Node3D", +"class": &"Train", "icon": "", "is_abstract": false, "is_tool": false, "language": &"GDScript", -"path": "res://scripts/trainjourney_camera.gd" -}, { -"base": &"PathFollow3D", -"class": &"TrainEngine", -"icon": "", -"is_abstract": false, -"is_tool": false, -"language": &"GDScript", -"path": "res://scripts/engine.gd" -}, { -"base": &"Camera3D", -"class": &"TrainControlCamera", -"icon": "", -"is_abstract": false, -"is_tool": false, -"language": &"GDScript", -"path": "res://scripts/traincontrol_camera.gd" -}, { -"base": &"RefCounted", -"class": &"OBJLoader", -"icon": "", -"is_abstract": false, -"is_tool": false, -"language": &"GDScript", -"path": "res://scripts/objloader.gd" +"path": "res://scripts/train.gd" }, { "base": &"Node3D", "class": &"TrackGenerator", @@ -39,11 +15,43 @@ list=[{ "language": &"GDScript", "path": "res://scripts/track_generator.gd" }, { -"base": &"Node3D", -"class": &"Train", +"base": &"RefCounted", +"class": &"OBJLoader", "icon": "", "is_abstract": false, "is_tool": false, "language": &"GDScript", -"path": "res://scripts/train.gd" +"path": "res://scripts/objloader.gd" +}, { +"base": &"Camera3D", +"class": &"TrainControlCamera", +"icon": "", +"is_abstract": false, +"is_tool": false, +"language": &"GDScript", +"path": "res://scripts/traincontrol_camera.gd" +}, { +"base": &"Camera3D", +"class": &"TrainJourneyCamera", +"icon": "", +"is_abstract": false, +"is_tool": false, +"language": &"GDScript", +"path": "res://scripts/trainjourney_camera.gd" +}, { +"base": &"MeshInstance3D", +"class": &"TrainBody", +"icon": "", +"is_abstract": false, +"is_tool": false, +"language": &"GDScript", +"path": "res://scripts/train_movement.gd" +}, { +"base": &"Area3D", +"class": &"RailSwitch", +"icon": "", +"is_abstract": false, +"is_tool": false, +"language": &"GDScript", +"path": "res://scripts/rail_switch.gd" }] diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index 4fb8b25e68486a9de043f4175d4d15b45145b129..311ab9c2484b8a31373a573e5b2b0e7201f137fc 100644 GIT binary patch delta 93 zcmeCSyKTqVxRG&-tnVhj^EXeP)M1oiU|=XpEw<9vFHSDXEGQ|~FG|eJi7zhCEJ@DL aOHX;eTeVu4pWPm(x{}P~jLn;5BN+ivmm#+R delta 15 Wcmca@*KNmGzmai^>}FQEFh&3`wFMIZ diff --git a/scenes/train_control.tscn b/scenes/train_control.tscn index e4d6b1e..c87e58c 100644 --- a/scenes/train_control.tscn +++ b/scenes/train_control.tscn @@ -7,6 +7,7 @@ [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"] +[ext_resource type="Script" uid="uid://b5x80gpkn1swt" path="res://scripts/rail_swtich.gd" id="7_cenvf"] [sub_resource type="PlaneMesh" id="PlaneMesh_23vqf"] size = Vector2(100, 100) @@ -17,10 +18,10 @@ 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) +"points": PackedVector3Array(-2.1678085, -0.043792725, 1.658886, 2.1678085, 0.043792725, -1.658886, -41.962486, 0.03566742, -44.78871, 0, 0, 0, 0, 0, 0, -7.760188, 0.036315918, -45.60305, -6.559948, 0.007423401, -0.16356277, 6.559948, -0.007423401, 0.16356277, 21.603975, 0.03604126, -45.26774, -3.4513588, 0.124176025, -4.544277, 3.4513588, -0.124176025, 4.544277, 40.931072, 0.032211304, -40.35701, 0.5563507, 0.09750366, -3.6268482, -0.5563507, -0.09750366, 3.6268482, 45.43544, 0.021453857, -26.947992, 3.438774, 0.09018707, -3.405755, -3.438774, -0.09018707, 3.405755, 38.412643, 0.47789, -9.150471, 6.6514378, -0.022911072, 0.7331085, -6.6514378, 0.022911072, -0.7331085, 26.96904, 0.003112793, -3.9279928, 5.315757, -0.10071564, 3.6390858, -5.315757, 0.10071564, -3.6390858, 3.4968712, 0.0079574585, -10.011598, 4.9409637, -0.0754776, 2.709568, -4.9409637, 0.0754776, -2.709568, -3.8321874, 0.024543762, -30.849133, 6.360344, 0.0488739, -1.9223251, -6.360344, -0.0488739, 1.9223251, -22.311077, 0.005493164, -31.887383, -0.9378357, 0.12989807, -4.797656, 0.9378357, -0.12989807, 4.797656, -31.28027, 0.015075684, -18.969343, -7.12364, 0.096969604, -3.4738579, 7.12364, -0.096969604, 3.4738579, -23.472174, 0.003479004, -4.4070177, -9.224047, 0.08418274, -2.961853, 9.224047, -0.08418274, 2.961853, 12.167218, -0.011207581, 14.035401, -8.825874, 0.03265381, -1.0564928, 8.825874, -0.03265381, 1.0564928, 32.632145, -0.011894226, 14.993831, 0, 0, 0, 0, 0, 0, 39.98447, -0.019104004, 24.146927, 4.9879036, 0.122177124, -4.6163826, -4.9879036, -0.122177124, 4.6163826, 35.724655, 0.047676086, 33.444454, 8.1661625, 0.014076233, -0.6628723, -8.1661625, -0.014076233, 0.6628723, 11.495622, 0.0951767, 40.647045, 4.9570847, -0.058029175, 2.0650558, -4.9570847, 0.058029175, -2.0650558, -22.318954, 0.051948547, 40.504288, 4.9869003, -0.18069458, 6.610588, -4.9869003, 0.18069458, -6.610588, -37.494194, 0.080329895, 26.992659, -1.5943985, -0.19984436, 7.435757, 1.5943985, 0.19984436, -7.435757, -46.58226, 0.10346222, 8.63745, -0.4270401, -0.16287994, 6.045038, 0.4270401, 0.16287994, -6.045038, -39.930115, 0.050865173, -11.514841, 4.8086166, -0.20992279, 7.687052, -4.8086166, 0.20992279, -7.687052, -35.56163, 0.15759277, -32.8561, -0.73628235, -0.15232849, 5.656826, 0.73628235, 0.15232849, -5.656826, -45.566254, 1.1692886, -39.59991), +"tilts": PackedFloat32Array(0, 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 +point_count = 23 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ke0jj"] albedo_texture = ExtResource("1_ihlg3") @@ -31,6 +32,14 @@ uv1_offset = Vector3(0, -0.61, 0) metallic = 1.0 roughness = 0.25 +[sub_resource type="Curve3D" id="Curve3D_1lqs8"] +closed = true +_data = { +"points": PackedVector3Array(-6.2964935, 0.06638336, -2.3570595, 6.2964935, -0.06638336, 2.3570595, 24, 0, -36, 0.40251923, 0.1432724, -5.316846, -0.40251923, -0.1432724, 5.316846, 30.535202, 0.016418457, -19.69652, -3.0211945, 0.21754456, -8.010609, 3.0211945, -0.21754456, 8.010609, 37.792625, 0.0013275146, -0.5123644, 7.037945, 0.16593933, -6.2738285, -7.037945, -0.16593933, 6.2738285, 33.177887, 0.0013427734, 21.921793, 12.049584, -0.0362854, 1.1334801, -12.049584, 0.0362854, -1.1334801, 7.185522, 0.0013427734, 33.84686, 3.006013, -0.23966217, 8.824167, -3.006013, 0.23966217, -8.824167, -5.633688, 0.0127334595, 16.86435, 0.09129143, -0.14064789, 5.2124147, -0.09129143, 0.14064789, -5.2124147, -20.520624, 0.0013427734, -3.9991686, -6.1595325, -0.18273163, 6.8687496, 6.1595325, 0.18273163, -6.8687496, -10.095118, 0.0013427734, -27.90497), +"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0) +} +point_count = 8 + [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) @@ -63,10 +72,18 @@ main_scene = ExtResource("2_0b1nv") mesh = SubResource("PlaneMesh_23vqf") surface_material_override/0 = SubResource("StandardMaterial3D_23vqf") -[node name="Rails" type="Path3D" parent="Ground" unique_id=1160818899] +[node name="Train" type="MeshInstance3D" parent="Ground" unique_id=65189673 node_paths=PackedStringArray("rail_a", "rail_b")] +transform = Transform3D(0.6867333, -0.014397784, -0.89729905, 0, 1.1300678, -0.018126683, 0.8974134, 0.011017708, 0.68664587, -41.962486, 0.03566742, -44.78871) +mesh = ExtResource("3_jy5c4") +skeleton = NodePath("../Rails1/TrainEngine") +script = ExtResource("6_1lqs8") +rail_a = NodePath("../Rails1") +rail_b = NodePath("../Rails2") + +[node name="Rails1" type="Path3D" parent="Ground" unique_id=1160818899] curve = SubResource("Curve3D_0b1nv") -[node name="Ballast" type="CSGPolygon3D" parent="Ground/Rails" unique_id=259312931] +[node name="Ballast" type="CSGPolygon3D" parent="Ground/Rails1" unique_id=259312931] polygon = PackedVector2Array(-1, 0, -1, 0.1, 1, 0.1, 1, 0) mode = 2 path_node = NodePath("..") @@ -81,7 +98,7 @@ path_u_distance = 1.0 path_joined = true material = SubResource("StandardMaterial3D_ke0jj") -[node name="LRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=477776682] +[node name="LRail" type="CSGPolygon3D" parent="Ground/Rails1" 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 @@ -97,7 +114,7 @@ path_u_distance = 1.0 path_joined = true material = SubResource("StandardMaterial3D_ihlg3") -[node name="RRail" type="CSGPolygon3D" parent="Ground/Rails" unique_id=965437995] +[node name="RRail" type="CSGPolygon3D" parent="Ground/Rails1" 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 @@ -113,14 +130,71 @@ 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) +[node name="TrainEngine" type="PathFollow3D" parent="Ground/Rails1" unique_id=973990755] +transform = Transform3D(0.6867333, -0.014397784, -0.89729905, 0, 1.1300678, -0.018126683, 0.8974134, 0.011017708, 0.68664587, -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="Rails2" type="Path3D" parent="Ground" unique_id=1426938039] +curve = SubResource("Curve3D_1lqs8") + +[node name="Ballast" type="CSGPolygon3D" parent="Ground/Rails2" unique_id=608449521] +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="RRail" type="CSGPolygon3D" parent="Ground/Rails2" unique_id=469196308] +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="LRail" type="CSGPolygon3D" parent="Ground/Rails2" unique_id=1887208549] +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="TrainEngine" type="PathFollow3D" parent="Ground/Rails2" unique_id=1618605131] +transform = Transform3D(-0.39616987, 0.010450672, -1.0582525, 0, 1.1301593, 0.01115706, 1.0583019, 0.003912155, -0.3961513, 24, 0, -36) +rotation_mode = 4 +script = ExtResource("2_jgp6u") + +[node name="RailSwtich" type="Area3D" parent="Ground" unique_id=1897237029 node_paths=PackedStringArray("rail_a", "rail_b", "switch_to_rail")] +script = ExtResource("7_cenvf") +rail_a = NodePath("../Rails1") +rail_b = NodePath("../Rails2") +switch_to_rail = NodePath("../Rails1") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1729725358] shadow_enabled = true @@ -135,7 +209,7 @@ current = true fov = 11.9 near = 0.001 script = ExtResource("4_jy5c4") -train = NodePath("../Ground/Rails/TrainEngine/Train") +train = NodePath("../Ground/Train") [node name="HUD" type="Control" parent="." unique_id=563257159] layout_mode = 3 @@ -174,6 +248,6 @@ text = "Comandi: \"W / S - Accelera / Rallenta\", \"A / D - Ruota camera\", \"SPACE - Cambia camera\", -\"TAB - Cambia treno\", +\"TAB\" - Cambia binario, \"ESC - Esci\"" label_settings = SubResource("LabelSettings_1lqs8") diff --git a/scripts/engine.gd b/scripts/engine.gd index 555a833..a655832 100644 --- a/scripts/engine.gd +++ b/scripts/engine.gd @@ -1,9 +1,9 @@ extends PathFollow3D -class_name TrainEngine - -@onready var train: MeshInstance3D = $Train - - -func _physics_process(delta: float) -> void: - if train: - progress += train.current_speed * delta +#class_name TrainEngine +# +#@onready var train: MeshInstance3D = $"../../Train" +# +# +#func _physics_process(delta: float) -> void: + #if train: + #progress += train.current_speed * delta diff --git a/scripts/rail_switch.gd b/scripts/rail_switch.gd new file mode 100644 index 0000000..d07a5de --- /dev/null +++ b/scripts/rail_switch.gd @@ -0,0 +1,17 @@ +extends Area3D +class_name RailSwitch + +@export var rail_a: Path3D +@export var rail_b: Path3D +@export var switch_to_rail: Path3D # Il binario verso cui deviare + +# Cambia direzione dello scambio +func toggle_switch() -> void: + if switch_to_rail == rail_a: + switch_to_rail = rail_b + else: + switch_to_rail = rail_a + +func _on_body_entered(body: Node3D) -> void: + if body is Train: + body.switch_to_rail(switch_to_rail) diff --git a/scripts/rail_switch.gd.uid b/scripts/rail_switch.gd.uid new file mode 100644 index 0000000..d424258 --- /dev/null +++ b/scripts/rail_switch.gd.uid @@ -0,0 +1 @@ +uid://bhan6tvt4sow diff --git a/scripts/rail_swtich.gd b/scripts/rail_swtich.gd new file mode 100644 index 0000000..ddb6334 --- /dev/null +++ b/scripts/rail_swtich.gd @@ -0,0 +1,14 @@ +extends Area3D + +@export var rail_a: Path3D +@export var rail_b: Path3D +@export var switch_to_rail: Path3D # Il binario verso cui deviare + + +# Cambia direzione dello scambio +func toggle_switch() -> void: + if switch_to_rail == rail_a: + switch_to_rail = rail_b + else: + switch_to_rail = rail_a + diff --git a/scripts/rail_swtich.gd.uid b/scripts/rail_swtich.gd.uid new file mode 100644 index 0000000..f47aa79 --- /dev/null +++ b/scripts/rail_swtich.gd.uid @@ -0,0 +1 @@ +uid://b5x80gpkn1swt diff --git a/scripts/train_movement.gd b/scripts/train_movement.gd index 2f595bf..333b547 100644 --- a/scripts/train_movement.gd +++ b/scripts/train_movement.gd @@ -1,21 +1,29 @@ extends MeshInstance3D +class_name TrainBody signal speed_changed(new_speed: float) +signal rail_switched(old_rail: Path3D, new_rail: Path3D) @export_group("Train") @export var base_speed: float = 15.0 @export var max_speed: float = 50.0 @export var min_speed: float = 3.0 @export var acceleration: float = 12.0 +@export var rail_a: Path3D +@export var rail_b: Path3D +var current_follower: PathFollow3D +var current_rail: Path3D var current_speed: float = 15.0 func _ready() -> void: current_speed = base_speed + switch_to_rail(rail_a) func _process(delta: float) -> void: _handle_input(delta) + current_follower.progress += current_speed * delta func _handle_input(delta: float) -> void: @@ -29,3 +37,35 @@ func _handle_input(delta: float) -> void: func get_speed() -> float: return current_speed + + +func switch_to_rail(new_rail: Path3D) -> void: + if new_rail == current_rail: + return + + current_rail = new_rail + current_follower = new_rail.get_node("TrainEngine") as PathFollow3D + + var closest_offset = find_closest_point_on_path(new_rail, global_position) + current_follower.progress = closest_offset + + +func find_closest_point_on_path(path: Path3D, point: Vector3) -> float: + var curve = path.curve + var closest_offset = 0.0 + var min_distance = INF + + var length = curve.get_baked_length() + var steps = 100 # Più alto = più preciso ma più lento + + for i in range(steps + 1): + var offset = (float(i) / steps) * length + # Trasforma il punto locale della curva in coordinate globali + var path_point = path.global_transform * curve.sample_baked(offset) + var dist = point.distance_to(path_point) + + if dist < min_distance: + min_distance = dist + closest_offset = offset + + return closest_offset diff --git a/scripts/traincontrol.gd b/scripts/traincontrol.gd index 26fce01..b461bcd 100644 --- a/scripts/traincontrol.gd +++ b/scripts/traincontrol.gd @@ -3,9 +3,9 @@ extends Node3D @onready var speed_label : Label = $HUD/speed_label @onready var camera_label : Label = $HUD/camera_label -@onready var train: MeshInstance3D = $Ground/Rails/TrainEngine/Train +@onready var train: MeshInstance3D = $Ground/Train @onready var camera: TrainControlCamera = $TrainCamera - + func _process(_delta: float) -> void: _update_ui() @@ -13,6 +13,8 @@ func _process(_delta: float) -> void: if Input.is_action_just_pressed("ui_cancel"): SceneSwitcher.switch_scene(main_scene.resource_path) + if Input.is_action_just_pressed("change_train"): + SceneSwitcher.switch_scene(main_scene.resource_path) func _update_ui() -> void: From dd1ba0fa9a2cece25e080511d021b8499c258e79 Mon Sep 17 00:00:00 2001 From: Overside srl Date: Sun, 1 Feb 2026 11:22:46 +0100 Subject: [PATCH 2/2] fix rail switch --- .godot/editor/editor_script_doc_cache.res | Bin 6243 -> 0 bytes scenes/train_control.tscn | 41 +++++++++++++--------- scripts/rail_swtich.gd | 3 ++ scripts/train_movement.gd | 9 ++--- scripts/traincontrol.gd | 29 ++++++++++++--- 5 files changed, 58 insertions(+), 24 deletions(-) delete mode 100644 .godot/editor/editor_script_doc_cache.res diff --git a/.godot/editor/editor_script_doc_cache.res b/.godot/editor/editor_script_doc_cache.res deleted file mode 100644 index 9284e45e92562e5765333bfab001a3c4b9041710..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6243 zcmV-p7@X%)Q$s@n000005C8y>c>n;T0{{Ta0ssJ80{{R30{{Td0ssI90{{R+0{{R{ z0ssIgwJ-f(01wR^0ET00IbeyB4loQOhG7_nVHk!1HAS{uImq7Jh$JCI?p^L_Vt;C? zSeVRIqu`7E1)RqE%&?EaH2R-_{1jFIS^!`GuLA64h1_PaM?*UsYLrg{GawNBxA?E% zUo@P;6%4AHhU0&M{|-sQG7W6PiSm;q2=~E39TRxY~Q5PNGr#&1B|d#R?7oq50YR3k!ft0qZD#V1X@Sxamx+juokkevn^u=2&%_O zGCTM`AwqeIP(i?EoHK7qAfWxU5}-S{$KD`nR0ZQ@*hLOuanhj1Pm)VM8YaU zc@7LhICe$5Vo{yZ($Tb|U6#%t06`5^o&@wFKc`>Y$ zD^?S{`gBOxPC1@0-bx6I+Gn~xpYlP2Lydqm5*F$z;|##7_<(c_$@jujV@Q~Cn~e1{ zW;wCt6k1%V8dea6l4;#=I>VLPjpb6f0aiapIAEv?x?EtE9D?KP^$K|;o5Ecu$pPjw zKw3JwaH;U}AdKzcSSuI=AiV{eb%DaPD6S*2rv;v{AXT*^P}|k_h$&JX<|<@={DPDl zn9%eYZt|8>Z|Bn96>=1lvN|E^k^3sDgxP*U`2?|Ci~G!0qRdGPaKLn98NoIP&2ZQ^ zz=0Du^N^}?J*mmW+sQK+K4(R-iiu4&_bKm26xJqdV9yx@YNAo+snUf4jVucGvR5V8N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AfTuL?jxCMq#D{ByhvIx!BiOD^e!EkLw|7_>89y7jS`Y|uf~aLl>56ng*$JV9({@E5D3mUXOnJsY z7CV{M2^MFynNkB`JV+Q_Orbq@(L=0Q??b-339z>1z!F^qWk_qw_noc^eH0ePsahTBJt!b%h2N zLWo+tyMw#b+BZ_qATP>JfPZFHzhaxDC_GFC&P()vR0JrmF^qCS)eC}S3>`-nJl=1$ NQ>o-7Q~^>`Lqqa+TVMbH diff --git a/scenes/train_control.tscn b/scenes/train_control.tscn index c87e58c..5558f9e 100644 --- a/scenes/train_control.tscn +++ b/scenes/train_control.tscn @@ -18,7 +18,7 @@ albedo_color = Color(2.153851e-06, 0.25305444, 0.03645257, 1) [sub_resource type="Curve3D" id="Curve3D_0b1nv"] closed = true _data = { -"points": PackedVector3Array(-2.1678085, -0.043792725, 1.658886, 2.1678085, 0.043792725, -1.658886, -41.962486, 0.03566742, -44.78871, 0, 0, 0, 0, 0, 0, -7.760188, 0.036315918, -45.60305, -6.559948, 0.007423401, -0.16356277, 6.559948, -0.007423401, 0.16356277, 21.603975, 0.03604126, -45.26774, -3.4513588, 0.124176025, -4.544277, 3.4513588, -0.124176025, 4.544277, 40.931072, 0.032211304, -40.35701, 0.5563507, 0.09750366, -3.6268482, -0.5563507, -0.09750366, 3.6268482, 45.43544, 0.021453857, -26.947992, 3.438774, 0.09018707, -3.405755, -3.438774, -0.09018707, 3.405755, 38.412643, 0.47789, -9.150471, 6.6514378, -0.022911072, 0.7331085, -6.6514378, 0.022911072, -0.7331085, 26.96904, 0.003112793, -3.9279928, 5.315757, -0.10071564, 3.6390858, -5.315757, 0.10071564, -3.6390858, 3.4968712, 0.0079574585, -10.011598, 4.9409637, -0.0754776, 2.709568, -4.9409637, 0.0754776, -2.709568, -3.8321874, 0.024543762, -30.849133, 6.360344, 0.0488739, -1.9223251, -6.360344, -0.0488739, 1.9223251, -22.311077, 0.005493164, -31.887383, -0.9378357, 0.12989807, -4.797656, 0.9378357, -0.12989807, 4.797656, -31.28027, 0.015075684, -18.969343, -7.12364, 0.096969604, -3.4738579, 7.12364, -0.096969604, 3.4738579, -23.472174, 0.003479004, -4.4070177, -9.224047, 0.08418274, -2.961853, 9.224047, -0.08418274, 2.961853, 12.167218, -0.011207581, 14.035401, -8.825874, 0.03265381, -1.0564928, 8.825874, -0.03265381, 1.0564928, 32.632145, -0.011894226, 14.993831, 0, 0, 0, 0, 0, 0, 39.98447, -0.019104004, 24.146927, 4.9879036, 0.122177124, -4.6163826, -4.9879036, -0.122177124, 4.6163826, 35.724655, 0.047676086, 33.444454, 8.1661625, 0.014076233, -0.6628723, -8.1661625, -0.014076233, 0.6628723, 11.495622, 0.0951767, 40.647045, 4.9570847, -0.058029175, 2.0650558, -4.9570847, 0.058029175, -2.0650558, -22.318954, 0.051948547, 40.504288, 4.9869003, -0.18069458, 6.610588, -4.9869003, 0.18069458, -6.610588, -37.494194, 0.080329895, 26.992659, -1.5943985, -0.19984436, 7.435757, 1.5943985, 0.19984436, -7.435757, -46.58226, 0.10346222, 8.63745, -0.4270401, -0.16287994, 6.045038, 0.4270401, 0.16287994, -6.045038, -39.930115, 0.050865173, -11.514841, 4.8086166, -0.20992279, 7.687052, -4.8086166, 0.20992279, -7.687052, -35.56163, 0.15759277, -32.8561, -0.73628235, -0.15232849, 5.656826, 0.73628235, 0.15232849, -5.656826, -45.566254, 1.1692886, -39.59991), +"points": PackedVector3Array(-2.1678085, -0.043792725, 1.658886, 2.1678085, 0.043792725, -1.658886, -41.962486, 0.03566742, -44.78871, 0, 0, 0, 0, 0, 0, -7.760188, 0.036315918, -45.60305, -6.559948, 0.007423401, -0.16356277, 6.559948, -0.007423401, 0.16356277, 21.603975, 0.03604126, -45.26774, -3.4513588, 0.124176025, -4.544277, 3.4513588, -0.124176025, 4.544277, 40.931072, 0.032211304, -40.35701, 0.5563507, 0.09750366, -3.6268482, -0.5563507, -0.09750366, 3.6268482, 45.43544, 0.021453857, -26.947992, 3.438774, 0.09018707, -3.405755, -3.438774, -0.09018707, 3.405755, 38.412643, 0.47789, -9.150471, 6.6514378, -0.022911072, 0.7331085, -6.6514378, 0.022911072, -0.7331085, 25.856459, 0.10243797, -3.7440395, 5.315757, -0.10071564, 3.6390858, -5.315757, 0.10071564, -3.6390858, 3.4968712, 0.0079574585, -10.011598, 4.9409637, -0.0754776, 2.709568, -4.9409637, 0.0754776, -2.709568, -3.8321874, 0.024543762, -30.849133, 6.360344, 0.0488739, -1.9223251, -6.360344, -0.0488739, 1.9223251, -22.311077, 0.005493164, -31.887383, -0.9378357, 0.12989807, -4.797656, 0.9378357, -0.12989807, 4.797656, -31.28027, 0.015075684, -18.969343, -7.12364, 0.096969604, -3.4738579, 7.12364, -0.096969604, 3.4738579, -23.472174, 0.003479004, -4.4070177, -9.224047, 0.08418274, -2.961853, 9.224047, -0.08418274, 2.961853, 12.167218, -0.011207581, 14.035401, -8.825874, 0.03265381, -1.0564928, 8.825874, -0.03265381, 1.0564928, 32.632145, -0.011894226, 14.993831, 0, 0, 0, 0, 0, 0, 39.98447, -0.019104004, 24.146927, 4.9879036, 0.122177124, -4.6163826, -4.9879036, -0.122177124, 4.6163826, 35.724655, 0.047676086, 33.444454, 8.1661625, 0.014076233, -0.6628723, -8.1661625, -0.014076233, 0.6628723, 11.495622, 0.0951767, 40.647045, 4.9570847, -0.058029175, 2.0650558, -4.9570847, 0.058029175, -2.0650558, -22.318954, 0.051948547, 40.504288, 4.9869003, -0.18069458, 6.610588, -4.9869003, 0.18069458, -6.610588, -37.494194, 0.080329895, 26.992659, -1.5943985, -0.19984436, 7.435757, 1.5943985, 0.19984436, -7.435757, -46.58226, 0.10346222, 8.63745, -0.4270401, -0.16287994, 6.045038, 0.4270401, 0.16287994, -6.045038, -39.930115, 0.050865173, -11.514841, 4.8086166, -0.20992279, 7.687052, -4.8086166, 0.20992279, -7.687052, -35.56163, 0.15759277, -32.8561, -0.73628235, -0.15232849, 5.656826, 0.73628235, 0.15232849, -5.656826, -45.566254, 0.602231, -39.59991), "tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) } point_count = 23 @@ -72,14 +72,6 @@ main_scene = ExtResource("2_0b1nv") mesh = SubResource("PlaneMesh_23vqf") surface_material_override/0 = SubResource("StandardMaterial3D_23vqf") -[node name="Train" type="MeshInstance3D" parent="Ground" unique_id=65189673 node_paths=PackedStringArray("rail_a", "rail_b")] -transform = Transform3D(0.6867333, -0.014397784, -0.89729905, 0, 1.1300678, -0.018126683, 0.8974134, 0.011017708, 0.68664587, -41.962486, 0.03566742, -44.78871) -mesh = ExtResource("3_jy5c4") -skeleton = NodePath("../Rails1/TrainEngine") -script = ExtResource("6_1lqs8") -rail_a = NodePath("../Rails1") -rail_b = NodePath("../Rails2") - [node name="Rails1" type="Path3D" parent="Ground" unique_id=1160818899] curve = SubResource("Curve3D_0b1nv") @@ -131,7 +123,7 @@ path_joined = true material = SubResource("StandardMaterial3D_ihlg3") [node name="TrainEngine" type="PathFollow3D" parent="Ground/Rails1" unique_id=973990755] -transform = Transform3D(0.6867333, -0.014397784, -0.89729905, 0, 1.1300678, -0.018126683, 0.8974134, 0.011017708, 0.68664587, -41.962486, 0.03566742, -44.78871) +transform = Transform3D(0.6867339, -0.014397825, -0.8973005, 0, 1.130071, -0.018126711, 0.8974141, 0.01101774, 0.68664694, -41.962486, 0.03566742, -44.78871) rotation_mode = 4 script = ExtResource("2_jgp6u") @@ -190,6 +182,12 @@ transform = Transform3D(-0.39616987, 0.010450672, -1.0582525, 0, 1.1301593, 0.01 rotation_mode = 4 script = ExtResource("2_jgp6u") +[node name="Train" type="MeshInstance3D" parent="Ground" unique_id=65189673] +transform = Transform3D(0.6867333, -0.014397784, -0.89729905, 0, 1.1300678, -0.018126683, 0.8974134, 0.011017708, 0.68664587, -41.962486, 0.03566742, -44.78871) +mesh = ExtResource("3_jy5c4") +skeleton = NodePath("../Rails1/TrainEngine") +script = ExtResource("6_1lqs8") + [node name="RailSwtich" type="Area3D" parent="Ground" unique_id=1897237029 node_paths=PackedStringArray("rail_a", "rail_b", "switch_to_rail")] script = ExtResource("7_cenvf") rail_a = NodePath("../Rails1") @@ -210,6 +208,7 @@ fov = 11.9 near = 0.001 script = ExtResource("4_jy5c4") train = NodePath("../Ground/Train") +follow_distance = 30.0 [node name="HUD" type="Control" parent="." unique_id=563257159] layout_mode = 3 @@ -229,9 +228,9 @@ label_settings = SubResource("LabelSettings_1lqs8") [node name="camera_label" type="Label" parent="HUD" unique_id=1719494020] layout_mode = 0 -offset_left = 20.0 +offset_left = 19.0 offset_top = 43.0 -offset_right = 1280.0 +offset_right = 1279.0 offset_bottom = 66.0 size_flags_vertical = 0 text = "Camera: " @@ -239,10 +238,10 @@ 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 +offset_left = 19.0 +offset_top = 83.0 +offset_right = 1279.0 +offset_bottom = 236.0 size_flags_vertical = 0 text = "Comandi: \"W / S - Accelera / Rallenta\", @@ -251,3 +250,13 @@ text = "Comandi: \"TAB\" - Cambia binario, \"ESC - Esci\"" label_settings = SubResource("LabelSettings_1lqs8") + +[node name="switch_label" type="Label" parent="HUD" unique_id=462391845] +layout_mode = 0 +offset_left = 19.0 +offset_top = 64.0 +offset_right = 1279.0 +offset_bottom = 87.0 +size_flags_vertical = 0 +text = "Binario: " +label_settings = SubResource("LabelSettings_1lqs8") diff --git a/scripts/rail_swtich.gd b/scripts/rail_swtich.gd index ddb6334..68738c7 100644 --- a/scripts/rail_swtich.gd +++ b/scripts/rail_swtich.gd @@ -11,4 +11,7 @@ func toggle_switch() -> void: switch_to_rail = rail_b else: switch_to_rail = rail_a + +#func get_state_name() -> String: + #return "BIANRIO 1" if current_state == SwitchState.LEFT else "BINARIO 2" diff --git a/scripts/train_movement.gd b/scripts/train_movement.gd index 333b547..745bb36 100644 --- a/scripts/train_movement.gd +++ b/scripts/train_movement.gd @@ -9,8 +9,8 @@ signal rail_switched(old_rail: Path3D, new_rail: Path3D) @export var max_speed: float = 50.0 @export var min_speed: float = 3.0 @export var acceleration: float = 12.0 -@export var rail_a: Path3D -@export var rail_b: Path3D +@onready var rail_a: Path3D = $"../Rails1" +@onready var rail_b: Path3D = $"../Rails2" var current_follower: PathFollow3D var current_rail: Path3D @@ -24,6 +24,7 @@ func _ready() -> void: func _process(delta: float) -> void: _handle_input(delta) current_follower.progress += current_speed * delta + global_transform = current_follower.global_transform func _handle_input(delta: float) -> void: @@ -48,8 +49,8 @@ func switch_to_rail(new_rail: Path3D) -> void: var closest_offset = find_closest_point_on_path(new_rail, global_position) current_follower.progress = closest_offset - - + + func find_closest_point_on_path(path: Path3D, point: Vector3) -> float: var curve = path.curve var closest_offset = 0.0 diff --git a/scripts/traincontrol.gd b/scripts/traincontrol.gd index b461bcd..6b4faa9 100644 --- a/scripts/traincontrol.gd +++ b/scripts/traincontrol.gd @@ -5,7 +5,9 @@ extends Node3D @onready var camera_label : Label = $HUD/camera_label @onready var train: MeshInstance3D = $Ground/Train @onready var camera: TrainControlCamera = $TrainCamera - +@onready var rail_switch: Area3D = $Ground/RailSwtich +@onready var switch_label : Label = $HUD/switch_label + func _process(_delta: float) -> void: _update_ui() @@ -14,9 +16,9 @@ func _process(_delta: float) -> void: SceneSwitcher.switch_scene(main_scene.resource_path) if Input.is_action_just_pressed("change_train"): - SceneSwitcher.switch_scene(main_scene.resource_path) - - + _toggle_rail() + + func _update_ui() -> void: if speed_label and train: var kmh = train.get_speed() * 3.6 @@ -24,3 +26,22 @@ func _update_ui() -> void: if camera_label and camera: camera_label.text = "Camera: %s" % camera.get_mode_name() + + +func _toggle_rail() -> void: + if train and rail_switch: + rail_switch.toggle_switch() + train.switch_to_rail(rail_switch.switch_to_rail) + + +func _update_switch_status(): + if not switch_label: + return + + #if rail_switch: + #var state_name = rail_switch.get_state_name() + #var color = Color.YELLOW if rail_switch.current_state == rail_switch.SwitchState.LEFT else Color.CYAN + #switch_label.text = "Scambio: %s" % state_name + #switch_label.add_theme_color_override("font_color", color) + #else: + #switch_label.text = "Scambio: N/A"