Refactoring main scene

This commit is contained in:
Lucas 2025-04-07 18:23:29 +02:00
parent 566db9d1b5
commit 054292b5b8
No known key found for this signature in database
7 changed files with 595 additions and 569 deletions

View file

@ -11,7 +11,7 @@ class_name Boat
var steering: float = 0 # steering rudder angle in radians
var thrust_force: float = 0 # forward thrust force in Newtons
var cam_rotation: Vector3
var cam_rotation = 0.0
var is_docked: bool = false
var submerged := false
@ -28,11 +28,14 @@ func _process(_delta):
if Input.get_action_strength("turn_left") > 0.0:
steer_left()
if Input.get_action_strength("camera_left") > 0.0:
cam_rotation += Vector3(0.0, 1.0, 0.0) * _delta
cam_rotation += 1.0 * _delta
if Input.get_action_strength("camera_right") > 0.0:
cam_rotation += Vector3(0.0, -1.0, 0.0) * _delta
$CamRoot.global_rotation = cam_rotation
cam_rotation += -1.0 * _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
cam_rotation =0.0
func _physics_process(delta):
## Code for user-input movement

View file

@ -62,9 +62,11 @@ metadata/_custom_type_script = "uid://cnfkxclrq0i0s"
shape = SubResource("BoxShape3D_g5njt")
[node name="CamRoot" type="Node3D" parent="."]
transform = Transform3D(0.0223035, 0, -0.999751, 0, 1, 0, 0.999751, 0, 0.0223035, 0, 0, 0)
[node name="Camera3D" type="Camera3D" parent="CamRoot"]
transform = Transform3D(0.489698, 0.510696, -0.706672, -0.000524954, 0.810677, 0.585494, 0.871892, -0.286344, 0.397255, -1.71955, 1.82832, 0.828034)
transform = Transform3D(0.999961, 0.00871108, 0.00177106, -0.00871108, 0.920573, 0.390473, 0.00177106, -0.390473, 0.920613, -0.0666215, 2.29821, 2.9863)
current = true
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.131158, 0)

View file

@ -33,9 +33,11 @@ var Oceantime:float
@onready var parentRigid:RigidBody3D = get_parent()
func _init() -> void:
pass
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
gizmo_extents = 1.0
if ocean_mat != null:
update_param()
if show_probe:

29
Main.tscn Normal file
View file

@ -0,0 +1,29 @@
[gd_scene load_steps=2 format=3 uid="uid://be4o88bqhgu3q"]
[ext_resource type="PackedScene" uid="uid://bhwuawppmqk4" path="res://OpenWorld.tscn" id="1_glv2v"]
[node name="Main" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
texture_filter = 1
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
stretch_shrink = 3
[node name="SubViewport" type="SubViewport" parent="SubViewportContainer"]
handle_input_locally = false
size = Vector2i(640, 360)
render_target_update_mode = 4
[node name="OpenWorld" parent="SubViewportContainer/SubViewport" instance=ExtResource("1_glv2v")]

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ config_version=5
config/name="ChatBoat"
config/version="0.1"
config/tags=PackedStringArray("games")
run/main_scene="uid://bhwuawppmqk4"
run/main_scene="uid://be4o88bqhgu3q"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://buntgqegmy578"]
[gd_scene load_steps=11 format=3 uid="uid://ddfxuxtwqg0yq"]
[ext_resource type="Script" uid="uid://cdnrxp6nu1wor" path="res://Ocean/ocean.gd" id="1_aqk2v"]
[ext_resource type="Script" uid="uid://cnfkxclrq0i0s" path="res://Boats/buyancy_probe.gd" id="2_fj7yv"]