Started work on buoyancy

This commit is contained in:
nc5432 2025-02-19 15:09:30 -05:00
parent b0f7ed78b4
commit 09d1c37d9d
7 changed files with 123 additions and 1 deletions

27
Scenes/Boid.tscn Normal file
View File

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=3 uid="uid://dfjspoi4g1tmx"]
[ext_resource type="Script" path="res://Scripts/Boid.gd" id="1_68eu8"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_1rqgl"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_qamgl"]
height = 0.822843
[sub_resource type="BoxShape3D" id="BoxShape3D_xf05q"]
size = Vector3(0.212891, 0.198242, 0.392822)
[node name="Boid" type="StaticBody3D"]
script = ExtResource("1_68eu8")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(0.2, 0, 0, 0, -8.74228e-09, -0.2, 0, 0.2, -8.74228e-09, 0, 0, 0)
mesh = SubResource("CapsuleMesh_1rqgl")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0.222042)
shape = SubResource("CylinderShape3D_qamgl")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_xf05q")

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bsvq2dl1vuwlu"]
[ext_resource type="Script" path="res://Scripts/BoidsController.gd" id="1_duomv"]
[node name="BoidsController" type="Node3D"]
script = ExtResource("1_duomv")

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=12 format=3 uid="uid://cvgligyy2psi8"] [gd_scene load_steps=15 format=3 uid="uid://cvgligyy2psi8"]
[ext_resource type="Material" uid="uid://b1f46mvfaphsh" path="res://Materials/Water.tres" id="1_p35v0"] [ext_resource type="Material" uid="uid://b1f46mvfaphsh" path="res://Materials/Water.tres" id="1_p35v0"]
[ext_resource type="Shader" path="res://Shaders/Water2.gdshader" id="2_07p2y"] [ext_resource type="Shader" path="res://Shaders/Water2.gdshader" id="2_07p2y"]
[ext_resource type="Texture2D" uid="uid://v6apgwie2maw" path="res://autumn_field_puresky_4k.exr" id="3_vl8or"] [ext_resource type="Texture2D" uid="uid://v6apgwie2maw" path="res://autumn_field_puresky_4k.exr" id="3_vl8or"]
[ext_resource type="Script" path="res://Scripts/BuoyantBody.gd" id="4_f67eq"]
[sub_resource type="PlaneMesh" id="PlaneMesh_gqyhx"] [sub_resource type="PlaneMesh" id="PlaneMesh_gqyhx"]
lightmap_size_hint = Vector2i(52, 52) lightmap_size_hint = Vector2i(52, 52)
@ -57,6 +58,10 @@ fog_light_color = Color(0.302729, 0.545879, 0.912975, 1)
fog_density = 1.0 fog_density = 1.0
volumetric_fog_emission = Color(0.427666, 0.607438, 0.994933, 1) volumetric_fog_emission = Color(0.427666, 0.607438, 0.994933, 1)
[sub_resource type="BoxMesh" id="BoxMesh_ffhgb"]
[sub_resource type="BoxShape3D" id="BoxShape3D_bt6if"]
[node name="WaterPlane" type="Node3D"] [node name="WaterPlane" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
@ -65,6 +70,7 @@ mesh = SubResource("PlaneMesh_gqyhx")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."] [node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.400336, 0, 11.821) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.400336, 0, 11.821)
visible = false
cast_shadow = 0 cast_shadow = 0
mesh = SubResource("PlaneMesh_w7hsm") mesh = SubResource("PlaneMesh_w7hsm")
@ -74,3 +80,38 @@ environment = SubResource("Environment_8bg6o")
[node name="Camera3D" type="Camera3D" parent="."] [node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(-0.718151, 0, 0.695888, 0, 1, 0, -0.695888, 0, -0.718151, 20.1979, 4.08685, -9.30518) transform = Transform3D(-0.718151, 0, 0.695888, 0, 1, 0, -0.695888, 0, -0.718151, 20.1979, 4.08685, -9.30518)
fov = 70.0 fov = 70.0
[node name="RigidBody3D" type="RigidBody3D" parent="." node_paths=PackedStringArray("samplePoints")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15.105, 1.67, -3.79)
script = ExtResource("4_f67eq")
samplePoints = [NodePath("Node3D"), NodePath("Node3D2"), NodePath("Node3D3"), NodePath("Node3D4"), NodePath("Node3D5"), NodePath("Node3D6"), NodePath("Node3D7"), NodePath("Node3D8")]
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
mesh = SubResource("BoxMesh_ffhgb")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
shape = SubResource("BoxShape3D_bt6if")
[node name="Node3D" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, -0.5, 0.5)
[node name="Node3D2" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -0.5, 0.5)
[node name="Node3D3" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.5, 0.5)
[node name="Node3D4" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.5, 0.5)
[node name="Node3D5" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.5, -0.5)
[node name="Node3D6" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.5, -0.5)
[node name="Node3D7" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -0.5, -0.5)
[node name="Node3D8" type="Node3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, -0.5, -0.5)

9
Scripts/Boid.gd Normal file
View File

@ -0,0 +1,9 @@
class_name Boid extends StaticBody3D
# 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

View File

@ -0,0 +1,13 @@
class_name BoidsController extends Node3D
@onready var boidScene: PackedScene = preload("res://Scenes/Boid.tscn")
var boids: Array[Boid]
# 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

21
Scripts/BuoyantBody.gd Normal file
View File

@ -0,0 +1,21 @@
extends RigidBody3D
enum WaveType{
SUM_E,
SUM_G
}
@export var samplePoints: Array[Node3D]
func getSumEHeight(x: float, y: float) -> float:
return 0
func getSumGHeight(x: float, y: float) -> float:
return 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _physics_process(delta: float) -> void:
pass

View File

@ -14,6 +14,11 @@ config/name="water shader"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[debug]
gdscript/warnings/untyped_declaration=2
gdscript/warnings/inferred_declaration=2
[dotnet] [dotnet]
project/assembly_name="water shader" project/assembly_name="water shader"