diff --git a/boat/boat.gd b/boat/boat.gd new file mode 100644 index 0000000..8554c3e --- /dev/null +++ b/boat/boat.gd @@ -0,0 +1,40 @@ +extends RigidBody3D + +@export var float_force := 40 +@export var water_drag := 0.05 +@export var water_angular_drag := 0.05 + +@onready var gravity:float = ProjectSettings.get_setting("physics/3d/default_gravity") + +const upforce_max := 500.0 +const water_height :=0.0 + +var inWater := false + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _physics_process(_delta: float) -> void: + var currentDepth = water_height - global_position.y + + if currentDepth > 0: + inWater = true + var force_to_apply:Vector3 = Vector3.UP * clamp(float_force * gravity * currentDepth,0.0,upforce_max) + + apply_central_force(force_to_apply) + else: + inWater = false + +func _integrate_forces(state: PhysicsDirectBodyState3D) -> void: + # Change comportement based on if in water or not + if inWater: + state.linear_velocity *= 1 - water_drag + state.angular_velocity *= 1 - water_angular_drag + diff --git a/boat/boat.gd.uid b/boat/boat.gd.uid new file mode 100644 index 0000000..18b5719 --- /dev/null +++ b/boat/boat.gd.uid @@ -0,0 +1 @@ +uid://crtr3lle7lx7g diff --git a/boat/boat.tscn b/boat/boat.tscn new file mode 100644 index 0000000..1696e5a --- /dev/null +++ b/boat/boat.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=4 format=3 uid="uid://babgqvkugifk1"] + +[ext_resource type="Script" uid="uid://crtr3lle7lx7g" path="res://boat/boat.gd" id="1_jbc2f"] +[ext_resource type="PackedScene" uid="uid://bcdjvsj0la72h" path="res://boat/source/untitled.fbx" id="2_enlnh"] +[ext_resource type="Shape3D" uid="uid://jdtw7cqqrtpb" path="res://boat/model/Boat_CollisionShape.tres" id="3_ml88t"] + +[node name="Boat" type="RigidBody3D"] +mass = 10.0 +script = ExtResource("1_jbc2f") + +[node name="SpringArm3D" type="SpringArm3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.893285, 0.449491, 0, -0.449491, 0.893285, 0, 0.350159, 0) +spring_length = 2.255 + +[node name="Camera3D" type="Camera3D" parent="SpringArm3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.107117, 0.323316, 2.70191) + +[node name="untitled" parent="." instance=ExtResource("2_enlnh")] +transform = Transform3D(-0.1, 0, -1.50996e-08, 0, 0.1, 0, 1.50996e-08, 0, -0.1, 0, -0.169637, 0) + +[node name="BoatCollision" type="CollisionShape3D" parent="."] +transform = Transform3D(-10, 8.74228e-07, 3.82137e-14, 0, -4.37114e-07, 10, 8.74228e-07, 10, 4.37114e-07, -0.179, 0.151184, 0) +shape = ExtResource("3_ml88t") diff --git a/boat/model.res b/boat/model.res new file mode 100644 index 0000000..9b148c6 Binary files /dev/null and b/boat/model.res differ diff --git a/boat/model/Boat_CollisionShape.tres b/boat/model/Boat_CollisionShape.tres new file mode 100644 index 0000000..948843d --- /dev/null +++ b/boat/model/Boat_CollisionShape.tres @@ -0,0 +1,4 @@ +[gd_resource type="ConvexPolygonShape3D" format=3 uid="uid://jdtw7cqqrtpb"] + +[resource] +points = PackedVector3Array(0.00746999, 0.0544247, 0.0456643, 0.00631786, 0.0433309, 0.0603996, 0.0443381, 0.0358498, 0.0593709, 0.0173409, 0.0521015, 0.0455405, 0.0193805, 0.0277719, 0.0015252, 0.00851313, 0.0290933, -0.000255981, -0.00198057, 0.029104, -0.000617933, -0.0124743, 0.029104, -0.000979885, -0.0340689, 0.0282727, -0.000865585, -0.0516933, 0.025779, -0.000360757, -0.0523161, 0.0276866, 0.00488755, -0.0536083, 0.0327273, 0.0224327, -0.053079, 0.033015, 0.0289002, -0.0691621, 0.0269619, 0.0304814, -0.0680567, 0.0257044, 0.039254, -0.00895561, 0.0448549, 0.0605139, -0.00302371, 0.00995353, 0.078983, 0.0593624, 0.0253421, 0.0589518, 0.0473585, 0.0415938, 0.0458644, 0.038593, 0.0460697, 0.045931, 0.033533, 0.0259815, 0.0044875, 0.0385152, 0.0307451, 0.0159461, 0.0173409, 0.0252675, -0.00291347, 0.00851313, 0.0264824, -0.0041803, -0.0124743, 0.0264824, -0.00493278, -0.0338665, 0.0257257, -0.00484706, -0.0508837, 0.0234665, -0.00435176, -0.063635, 0.0188947, -0.00382788, -0.0654099, 0.0207703, 0.000172647, -0.0668111, 0.0223049, 0.00554478, -0.0696759, 0.0265783, 0.0240139, -0.0824271, 0.0168166, 0.0318435, -0.0811037, 0.0158681, 0.0406256, -0.0117892, 0.00995353, 0.078221, -0.00319497, -1.11759e-08, 0.0809547, 0.064329, -1.11759e-08, 0.0588661, 0.0556725, 0.0231041, 0.0292812, 0.0507371, 0.0204932, 0.0159461, 0.0312754, 0.0236476, 0.000496499, 0.0159085, 0.0220917, -0.0072569, 0.00851313, 0.0231468, -0.00806653, -0.00198057, 0.0231574, -0.00847611, -0.0124743, 0.0231574, -0.00888568, -0.0336174, 0.0224967, -0.00891426, -0.0498561, 0.0205145, -0.00845706, -0.0614553, 0.0165182, -0.00793318, -0.0722604, 0.0112537, -0.0036469, -0.0752808, 0.0123726, 0.000344098, -0.0777563, 0.0133105, 0.00585911, -0.0827385, 0.016337, 0.0253664, -0.0913327, 0.00670318, 0.0328055, -0.0898848, 0.00598916, 0.0415781, -0.0119605, -1.06655e-05, 0.0801927, -0.0927495, -1.11759e-08, 0.0419305, -0.00302371, -0.00996421, 0.078983, 0.0593624, -0.0253528, 0.0589518, 0.0556725, -0.0231148, 0.0292812, 0.0603589, -1.11759e-08, 0.030348, 0.0551587, -1.11759e-08, 0.0169082, 0.0460196, -1.11759e-08, 0.00546858, 0.0424542, 0.0174666, 0.00661159, 0.0282239, 0.0206744, -0.0036088, 0.014445, 0.0172109, -0.010905, 0.00851313, 0.0180315, -0.0113812, -0.0124743, 0.0180421, -0.0122766, -0.0333527, 0.0175306, -0.01241, -0.0487974, 0.0159853, -0.0119909, -0.05926, 0.0128842, -0.011467, -0.0651608, 0.00767295, -0.011286, -0.068695, 0.00981499, -0.0077522, -0.0771803, 0.00384713, -0.0036469, -0.0812438, 0.00424143, 0.000344098, -0.0846535, 0.00458245, 0.00597341, -0.0914417, 0.00628756, 0.0263189, -0.0947268, -1.11759e-08, 0.0266428, -0.0946646, -1.11759e-08, 0.0331579, -0.0117892, -0.00996421, 0.078221, -0.0898848, -0.00599984, 0.0415781, -0.00895561, -0.0448655, 0.0605139, 0.00631786, -0.0433416, 0.0603996, 0.0443381, -0.0358605, 0.0593709, 0.0473585, -0.0416045, 0.0458644, 0.0507371, -0.0205039, 0.0159461, 0.0424542, -0.0174773, 0.00661159, 0.0412398, -1.11759e-08, 0.00142043, 0.0313222, 0.0152713, -0.00329447, 0.0255615, 0.0150049, -0.0069521, 0.0132929, 0.00960185, -0.0130386, 0.00851313, 0.0100601, -0.0135911, -0.00198057, 0.0100601, -0.0140578, -0.0124743, 0.0100601, -0.014515, -0.0331347, 0.00978302, -0.0146864, -0.0479567, 0.00895178, -0.0142769, -0.0575007, 0.00726799, -0.0137435, -0.0623116, 0.00443326, -0.013572, -0.0641488, 0.0016305, -0.013572, -0.0678854, 0.00262159, -0.011286, -0.0724783, 0.0033356, -0.0077522, -0.0788306, -1.11759e-08, -0.0036469, -0.0832367, -1.11759e-08, 0.000344098, -0.0869578, -1.11759e-08, 0.00601151, -0.0914417, -0.00629823, 0.0263189, -0.0913327, -0.00671385, 0.0328055, -0.0846535, -0.00459313, 0.00597341, -0.0811037, -0.0158788, 0.0406256, -0.0824271, -0.0168272, 0.0318435, -0.0680567, -0.0257151, 0.039254, 0.00746999, -0.0544354, 0.0456643, 0.0173409, -0.0521122, 0.0455405, 0.038593, -0.0460804, 0.045931, 0.0385152, -0.0307558, 0.0159461, 0.033533, -0.0259922, 0.0044875, 0.0312754, -0.0236583, 0.000496499, 0.0282239, -0.020685, -0.0036088, 0.0313222, -0.015282, -0.00329447, 0.0345138, -1.11759e-08, -0.00370405, 0.0221674, -1.11759e-08, -0.0104954, 0.0132929, -1.11759e-08, -0.014696, 0.0132929, 0.00270684, -0.0142864, 0.00851313, 0.00283473, -0.0148388, -0.00198057, 0.00283473, -0.0153056, -0.0124743, 0.00283473, -0.0157628, -0.0329946, 0.00277078, -0.0159342, -0.0473962, 0.00255765, -0.0155246, -0.0597894, -1.11759e-08, -0.0152294, -0.0604121, 0.00142802, -0.0148198, -0.0617355, -1.11759e-08, -0.0148198, -0.0647715, -1.11759e-08, -0.013572, -0.0687884, -1.11759e-08, -0.011286, -0.0737394, -1.11759e-08, -0.0077522, -0.0724783, -0.00334628, -0.0077522, -0.0771803, -0.00385781, -0.0036469, -0.0812438, -0.00425211, 0.000344098, -0.0777563, -0.0133211, 0.00585911, -0.0827385, -0.0163477, 0.0253664, -0.0752808, -0.0123833, 0.000344098, -0.0691621, -0.0269726, 0.0304814, -0.0696759, -0.026589, 0.0240139, 0.00851313, -0.029104, -0.000255981, 0.0193805, -0.0277825, 0.0015252, -0.053079, -0.0330257, 0.0289002, -0.0536083, -0.032738, 0.0224327, -0.0523161, -0.0276973, 0.00488755, -0.0516933, -0.0257897, -0.000360757, -0.0340689, -0.0282834, -0.000865585, -0.0124743, -0.0291146, -0.000979885, -0.00198057, -0.0291146, -0.000617933, 0.0173409, -0.0252782, -0.00291347, 0.0159085, -0.0221024, -0.0072569, 0.014445, -0.0172216, -0.010905, 0.0255615, -0.0150156, -0.0069521, 0.0132929, -0.00271752, -0.0142864, 0.00851313, -0.0028454, -0.0148388, 0.00851313, -1.11759e-08, -0.0152579, -0.0124743, -1.11759e-08, -0.0161724, -0.0329479, -1.11759e-08, -0.0163438, -0.0472094, -1.11759e-08, -0.0159342, -0.0479567, -0.00896246, -0.0142769, -0.0575007, -0.00727867, -0.0137435, -0.0604121, -0.00143869, -0.0148198, -0.0473962, -0.00256832, -0.0155246, -0.0623116, -0.00444394, -0.013572, -0.0641488, -0.00164117, -0.013572, -0.0678854, -0.00263226, -0.011286, -0.0651608, -0.00768363, -0.011286, -0.068695, -0.00982567, -0.0077522, -0.0722604, -0.0112643, -0.0036469, -0.0654099, -0.020781, 0.000172647, -0.0668111, -0.0223155, 0.00554478, -0.063635, -0.0189053, -0.00382788, 0.00851313, -0.026493, -0.0041803, -0.0508837, -0.0234771, -0.00435176, -0.0338665, -0.0257364, -0.00484706, -0.0124743, -0.026493, -0.00493278, 0.00851313, -0.0231574, -0.00806653, 0.00851313, -0.0180421, -0.0113812, 0.00851313, -0.0100708, -0.0135911, 0.0132929, -0.00961253, -0.0130386, -0.00198057, -0.0028454, -0.0153056, -0.0124743, -0.0028454, -0.0157628, -0.0329946, -0.00278146, -0.0159342, -0.0487974, -0.015996, -0.0119909, -0.0331347, -0.0097937, -0.0146864, -0.0333527, -0.0175413, -0.01241, -0.05926, -0.0128949, -0.011467, -0.0614553, -0.0165289, -0.00793318, -0.0124743, -0.0231681, -0.00888568, -0.00198057, -0.0231681, -0.00847611, -0.0498561, -0.0205252, -0.00845706, -0.0336174, -0.0225074, -0.00891426, -0.0124743, -0.0180528, -0.0122766, -0.0124743, -0.0100708, -0.014515, -0.00198057, -0.0100708, -0.0140578) diff --git a/boat/ring.res b/boat/ring.res new file mode 100644 index 0000000..efda4c0 Binary files /dev/null and b/boat/ring.res differ diff --git a/boat/source/untitled.fbx b/boat/source/untitled.fbx new file mode 100644 index 0000000..00f38d1 Binary files /dev/null and b/boat/source/untitled.fbx differ diff --git a/boat/source/untitled.fbx.import b/boat/source/untitled.fbx.import new file mode 100644 index 0000000..e85c3ec --- /dev/null +++ b/boat/source/untitled.fbx.import @@ -0,0 +1,70 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://bcdjvsj0la72h" +path="res://.godot/imported/untitled.fbx-2cb6bc55ac8aef17b1fe3f0d79b293bf.scn" + +[deps] + +source_file="res://boat/source/untitled.fbx" +dest_files=["res://.godot/imported/untitled.fbx-2cb6bc55ac8aef17b1fe3f0d79b293bf.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=true +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={ +"meshes": { +"Mesh": { +"generate/lightmap_uv": 0, +"generate/lods": 0, +"generate/shadow_meshes": 0, +"lods/normal_merge_angle": 60.0, +"save_to_file/enabled": true, +"save_to_file/path": "res://boat/ring.res" +}, +"Mesh_001": { +"generate/lightmap_uv": 0, +"generate/lods": 0, +"generate/shadow_meshes": 0, +"lods/normal_merge_angle": 60.0, +"save_to_file/enabled": true, +"save_to_file/path": "uid://b1pl5cswnak87" +}, +"Mesh_016": { +"generate/lightmap_uv": 0, +"generate/lods": 0, +"generate/shadow_meshes": 0, +"lods/normal_merge_angle": 60.0, +"save_to_file/enabled": true, +"save_to_file/path": "res://boat/model.res" +} +}, +"nodes": { +"PATH:Plane": { +"import/skip_import": true +} +} +} +fbx/importer=0 +fbx/allow_geometry_helper_nodes=false +fbx/embedded_image_handling=1 diff --git a/boat/textures/Untitled.png b/boat/textures/Untitled.png new file mode 100644 index 0000000..fe30cd4 Binary files /dev/null and b/boat/textures/Untitled.png differ diff --git a/boat/textures/Untitled.png.import b/boat/textures/Untitled.png.import new file mode 100644 index 0000000..3c296f5 --- /dev/null +++ b/boat/textures/Untitled.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://scfxcj65nmxx" +path.s3tc="res://.godot/imported/Untitled.png-2e9d8314f2286b97d61a8694354e2606.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://boat/textures/Untitled.png" +dest_files=["res://.godot/imported/Untitled.png-2e9d8314f2286b97d61a8694354e2606.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 diff --git a/kaykit/medieval/medieval_shader_code.tres b/kaykit/medieval/medieval_shader_code.tres index 8f43a71..5948b2e 100644 --- a/kaykit/medieval/medieval_shader_code.tres +++ b/kaykit/medieval/medieval_shader_code.tres @@ -24,7 +24,6 @@ void fragment() { } " -graph_offset = Vector2(-51.1487, -3.26273) modes/diffuse = 3 modes/specular = 1 nodes/fragment/4/node = SubResource("VisualShaderNodeTexture_stlk6")