From e148834d4f9068067c9766357366d1a845cc60df Mon Sep 17 00:00:00 2001 From: lucastucious Date: Thu, 3 Jul 2025 15:37:35 +0200 Subject: [PATCH] WIP : Weather presets --- Boats/boat.gd | 11 +++++---- Boats/buyancy_probe.gd | 6 ++--- Ocean/WeatherManager.gd | 20 ++++++++++++---- Ocean/ocean.gd | 2 +- Ocean/weather/weather_preset.gd | 7 ++++++ Ocean/weather/weather_preset.gd.uid | 1 + OpenWorld.tscn | 5 ++-- icons/Boat.svg.import | 37 +++++++---------------------- icons/Ocean.svg.import | 37 +++++++---------------------- icons/Ocean2.svg.import | 37 +++++++---------------------- icons/Probe.svg.import | 37 +++++++---------------------- icons/Weather.svg.import | 37 +++++++---------------------- project.godot | 9 +++++++ 13 files changed, 90 insertions(+), 156 deletions(-) create mode 100644 Ocean/weather/weather_preset.gd create mode 100644 Ocean/weather/weather_preset.gd.uid diff --git a/Boats/boat.gd b/Boats/boat.gd index 0802cb5..5aafdad 100644 --- a/Boats/boat.gd +++ b/Boats/boat.gd @@ -1,4 +1,4 @@ -@icon("uid://3ugrjpybrl4e") +@icon("uid://unv6tufgpbiy") extends RigidBody3D class_name Boat @@ -34,7 +34,7 @@ func _process(_delta): $CamRoot.global_rotation.y += cam_rotation $CamRoot.global_rotation.x = 0.0 $CamRoot.global_rotation.z = 0.0 - $CamRoot.global_position.y = 0.0 + #$CamRoot.global_position.y = 0.0 cam_rotation =0.0 func _physics_process(delta): @@ -46,9 +46,10 @@ func _physics_process(delta): ## but maybe it's too realistic for the game i want var wanted_force: Vector3 = global_transform.basis.x.normalized() * Vector3(1, 0, 1) * thrust_force * delta apply_central_force(wanted_force) - angular_damp = linear_velocity.length() # make the boat less affected by the sidewave when full speed - - apply_torque(global_transform.basis.y.normalized() * steering * clamp(linear_velocity.length(), 0.35, 1.0)) # for sideways motion + + angular_damp = 30.0 + clamp(linear_velocity.length(),0.5, linear_velocity.length())# make the boat less affected by the sidewave when full speed + if steering != 0.0: + apply_torque(global_transform.basis.y.normalized() * steering ) # for sideways motion reset_forces() diff --git a/Boats/buyancy_probe.gd b/Boats/buyancy_probe.gd index f7d4c47..5fa6ef9 100644 --- a/Boats/buyancy_probe.gd +++ b/Boats/buyancy_probe.gd @@ -1,4 +1,4 @@ -@icon("uid://ck86evu4iyhyg") +@icon("uid://dyq21h2nu7dpd") @tool extends Marker3D class_name BuyancyProbe @@ -49,11 +49,11 @@ func _ready() -> void: debug_sphere.height = 0.2 sphere_preview.mesh = debug_sphere if debug: - debug_label.billboard = 1 + debug_label.billboard = BaseMaterial3D.BILLBOARD_ENABLED debug_label.outline_render_priority = 98 debug_label.render_priority = 99 debug_label.pixel_size = 0.005 - debug_label.horizontal_alignment = 0 + debug_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_LEFT debug_label.no_depth_test = true debug_label.font_size = 50 add_child(debug_label) diff --git a/Ocean/WeatherManager.gd b/Ocean/WeatherManager.gd index dce0397..3e7442b 100644 --- a/Ocean/WeatherManager.gd +++ b/Ocean/WeatherManager.gd @@ -1,12 +1,24 @@ -@icon("uid://ckjj2o5jcfcy") +@tool +@icon("uid://dsorlwsjw10wl") extends Node class_name WeatherManager +@export var OceanRef : Ocean +var OceanShader:ShaderMaterial +@export var weather_preset:WeatherPreset: + set(new_preset): + weather_preset = new_preset + change_weather() + # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. + if !OceanRef: + print("Error:No Ocean ref !") + queue_free() + return + OceanShader = OceanRef.OceanShader -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(_delta: float) -> void: +func change_weather(): + # Set OceanShader parameters pass diff --git a/Ocean/ocean.gd b/Ocean/ocean.gd index 589039e..9359db4 100644 --- a/Ocean/ocean.gd +++ b/Ocean/ocean.gd @@ -1,5 +1,5 @@ @tool -@icon("uid://nwanoqn5yas8") +@icon("uid://bg0ym6kmn52ww") extends Node3D class_name Ocean diff --git a/Ocean/weather/weather_preset.gd b/Ocean/weather/weather_preset.gd new file mode 100644 index 0000000..016dede --- /dev/null +++ b/Ocean/weather/weather_preset.gd @@ -0,0 +1,7 @@ +extends Resource +class_name WeatherPreset + +@export_category("Ocean") + + +@export_category("Sky") diff --git a/Ocean/weather/weather_preset.gd.uid b/Ocean/weather/weather_preset.gd.uid new file mode 100644 index 0000000..5ee0a87 --- /dev/null +++ b/Ocean/weather/weather_preset.gd.uid @@ -0,0 +1 @@ +uid://pi263ugsgldt diff --git a/OpenWorld.tscn b/OpenWorld.tscn index 01c3225..88a79df 100644 --- a/OpenWorld.tscn +++ b/OpenWorld.tscn @@ -2170,10 +2170,9 @@ script = ExtResource("5_spien") float_strength = 2.0 metadata/_custom_type_script = "uid://cnfkxclrq0i0s" -[node name="WeatherManager" type="Node" parent="."] +[node name="WeatherManager" type="Node" parent="." node_paths=PackedStringArray("OceanRef")] script = ExtResource("6_kisq7") +OceanRef = NodePath("../Ocean") [node name="Boat" parent="." groups=["Boats"] instance=ExtResource("7_0g14k")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.134, 0.037, -0.449) -max_thrust_force = 5000.0 -max_steering = 15.0 diff --git a/icons/Boat.svg.import b/icons/Boat.svg.import index 21338cc..241e1ad 100644 --- a/icons/Boat.svg.import +++ b/icons/Boat.svg.import @@ -1,37 +1,18 @@ [remap] -importer="texture" -type="CompressedTexture2D" -uid="uid://3ugrjpybrl4e" -path="res://.godot/imported/Boat.svg-75bc0fadb884e0e75bf1a31ed1c977a6.ctex" -metadata={ -"vram_texture": false -} +importer="svg" +type="SVGTexture" +uid="uid://unv6tufgpbiy" +path="res://.godot/imported/Boat.svg-75bc0fadb884e0e75bf1a31ed1c977a6.svgtex" [deps] source_file="res://icons/Boat.svg" -dest_files=["res://.godot/imported/Boat.svg-75bc0fadb884e0e75bf1a31ed1c977a6.ctex"] +dest_files=["res://.godot/imported/Boat.svg-75bc0fadb884e0e75bf1a31ed1c977a6.svgtex"] [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 +base_scale=1.0 +saturation=1.0 +color_map={} +compress=false diff --git a/icons/Ocean.svg.import b/icons/Ocean.svg.import index 9a98b9f..46c3838 100644 --- a/icons/Ocean.svg.import +++ b/icons/Ocean.svg.import @@ -1,37 +1,18 @@ [remap] -importer="texture" -type="CompressedTexture2D" -uid="uid://6w31a2gju6bi" -path="res://.godot/imported/Ocean.svg-6c6a877658fd7781c0618a503ad7db85.ctex" -metadata={ -"vram_texture": false -} +importer="svg" +type="SVGTexture" +uid="uid://8tikn08ngktm" +path="res://.godot/imported/Ocean.svg-6c6a877658fd7781c0618a503ad7db85.svgtex" [deps] source_file="res://icons/Ocean.svg" -dest_files=["res://.godot/imported/Ocean.svg-6c6a877658fd7781c0618a503ad7db85.ctex"] +dest_files=["res://.godot/imported/Ocean.svg-6c6a877658fd7781c0618a503ad7db85.svgtex"] [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 +base_scale=1.0 +saturation=1.0 +color_map={} +compress=false diff --git a/icons/Ocean2.svg.import b/icons/Ocean2.svg.import index f0fe64c..d4a0111 100644 --- a/icons/Ocean2.svg.import +++ b/icons/Ocean2.svg.import @@ -1,37 +1,18 @@ [remap] -importer="texture" -type="CompressedTexture2D" -uid="uid://nwanoqn5yas8" -path="res://.godot/imported/Ocean2.svg-c7e900944be56916999acf20e410aafc.ctex" -metadata={ -"vram_texture": false -} +importer="svg" +type="SVGTexture" +uid="uid://bg0ym6kmn52ww" +path="res://.godot/imported/Ocean2.svg-c7e900944be56916999acf20e410aafc.svgtex" [deps] source_file="res://icons/Ocean2.svg" -dest_files=["res://.godot/imported/Ocean2.svg-c7e900944be56916999acf20e410aafc.ctex"] +dest_files=["res://.godot/imported/Ocean2.svg-c7e900944be56916999acf20e410aafc.svgtex"] [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 +base_scale=1.0 +saturation=1.0 +color_map={} +compress=false diff --git a/icons/Probe.svg.import b/icons/Probe.svg.import index 7878e4a..fb5b484 100644 --- a/icons/Probe.svg.import +++ b/icons/Probe.svg.import @@ -1,37 +1,18 @@ [remap] -importer="texture" -type="CompressedTexture2D" -uid="uid://ck86evu4iyhyg" -path="res://.godot/imported/Probe.svg-788444d16b202938a7211927a742dea3.ctex" -metadata={ -"vram_texture": false -} +importer="svg" +type="SVGTexture" +uid="uid://dyq21h2nu7dpd" +path="res://.godot/imported/Probe.svg-788444d16b202938a7211927a742dea3.svgtex" [deps] source_file="res://icons/Probe.svg" -dest_files=["res://.godot/imported/Probe.svg-788444d16b202938a7211927a742dea3.ctex"] +dest_files=["res://.godot/imported/Probe.svg-788444d16b202938a7211927a742dea3.svgtex"] [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 +base_scale=1.0 +saturation=1.0 +color_map={} +compress=false diff --git a/icons/Weather.svg.import b/icons/Weather.svg.import index 4492513..31a29d1 100644 --- a/icons/Weather.svg.import +++ b/icons/Weather.svg.import @@ -1,37 +1,18 @@ [remap] -importer="texture" -type="CompressedTexture2D" -uid="uid://ckjj2o5jcfcy" -path="res://.godot/imported/Weather.svg-7b5f0f3c54711a8b10e89f516b3e247c.ctex" -metadata={ -"vram_texture": false -} +importer="svg" +type="SVGTexture" +uid="uid://dsorlwsjw10wl" +path="res://.godot/imported/Weather.svg-7b5f0f3c54711a8b10e89f516b3e247c.svgtex" [deps] source_file="res://icons/Weather.svg" -dest_files=["res://.godot/imported/Weather.svg-7b5f0f3c54711a8b10e89f516b3e247c.ctex"] +dest_files=["res://.godot/imported/Weather.svg-7b5f0f3c54711a8b10e89f516b3e247c.svgtex"] [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 +base_scale=1.0 +saturation=1.0 +color_map={} +compress=false diff --git a/project.godot b/project.godot index 3478a15..0f7a375 100644 --- a/project.godot +++ b/project.godot @@ -36,6 +36,15 @@ Ocean="Oceans" OceanTiles="" Boats="All player controlled vehicles" +[importer_defaults] + +svg={ +"base_scale": 1.0, +"color_map": {}, +"compress": true, +"saturation": 1.0 +} + [input] move_forward={