WIP : Weather presets

This commit is contained in:
Lucas 2025-07-03 15:37:35 +02:00
parent 8280fdf4cd
commit e148834d4f
No known key found for this signature in database
13 changed files with 90 additions and 156 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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

View file

@ -1,5 +1,5 @@
@tool
@icon("uid://nwanoqn5yas8")
@icon("uid://bg0ym6kmn52ww")
extends Node3D
class_name Ocean

View file

@ -0,0 +1,7 @@
extends Resource
class_name WeatherPreset
@export_category("Ocean")
@export_category("Sky")

View file

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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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={