Compare commits

...

2 commits

Author SHA1 Message Date
801423fa51
Updating defaults values of probe 2025-04-07 12:32:21 +02:00
4eafcb6a8d
Chnage pixelization mode
Now using SubViewport shrink to make UI not affected by pixelization
2025-04-07 12:31:57 +02:00
7 changed files with 609 additions and 539 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
.godot/
/android/
Builds
.vscode

View file

@ -2,9 +2,13 @@
extends RigidBody3D
class_name Boat
@export_category("Controls")
@export var max_thrust_force: float = 2048 * 3.0
@export var max_steering: float = 50.0
@export_category("Debug")
@export var debug: bool = false
var steering: float = 0 # steering rudder angle in radians
var thrust_force: float = 0 # forward thrust force in Newtons
var cam_rotation: Vector3
@ -33,10 +37,15 @@ func _process(_delta):
func _physics_process(delta):
## Code for user-input movement
if thrust_force > 0.0:
apply_central_force(self.global_transform.basis.x.normalized() * Vector3(1, 0, 1) * thrust_force * delta)
#apply_torque(Vector3.UP * steering * delta)
## TODO: Need to apply a force to the side based on steering value, to simulate ship axis rotation when turning
##
## IDEA: Maybe even apply_torque() should be removed and we simulate a turning with a force applying to the back of the ship
## 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(Input.get_action_strength("move_forward"),0.35,1.0) ) # for sideways motion
apply_torque(global_transform.basis.y.normalized() * steering * clamp(linear_velocity.length(), 0.35, 1.0)) # for sideways motion
reset_forces()

View file

@ -22,35 +22,40 @@ size = Vector3(0.1, 2.5, 0.1)
mass = 50.0
script = ExtResource("1_q76at")
max_thrust_force = 3000.0
max_steering = 20.0
max_steering = 10.0
debug = true
metadata/_custom_type_script = "uid://cjo6l2ykgvn4e"
[node name="BuyancyProbe" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, -0.0397125)
gizmo_extents = 1.0
script = ExtResource("3_dd4jx")
float_strength = 2.0
max_float_force = 1500.0
max_float_force = 3000.0
metadata/_custom_type_script = "uid://cnfkxclrq0i0s"
[node name="BuyancyProbe2" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0235078, 0, -0.5)
gizmo_extents = 1.0
script = ExtResource("3_dd4jx")
float_strength = 1.5
max_float_force = 1500.0
float_strength = 0.5
max_float_force = 3000.0
metadata/_custom_type_script = "uid://cnfkxclrq0i0s"
[node name="BuyancyProbe3" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0674343, 0, 0.5)
gizmo_extents = 1.0
script = ExtResource("3_dd4jx")
float_strength = 1.5
max_float_force = 1500.0
float_strength = 0.5
max_float_force = 3000.0
metadata/_custom_type_script = "uid://cnfkxclrq0i0s"
[node name="BuyancyProbe4" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, -0.0214682)
gizmo_extents = 1.0
script = ExtResource("3_dd4jx")
float_strength = 2.0
max_float_force = 1500.0
max_float_force = 3000.0
metadata/_custom_type_script = "uid://cnfkxclrq0i0s"
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
@ -60,9 +65,9 @@ shape = SubResource("BoxShape3D_g5njt")
[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)
current = true
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.131158, 0)
material_override = SubResource("StandardMaterial3D_bmmu8")
mesh = SubResource("BoxMesh_bmmu8")

View file

@ -4,11 +4,12 @@ extends Marker3D
class_name BuyancyProbe
## How much force is applied upward
@export var float_strength: float = 10.0
@export var float_strength: float = 1.0
@export var max_float_force:float = 500.0
var currentdepth:float
@export_category("Debug")
@export var debug :bool = false
@export var show_probe :bool = false:
set(_value):
show_probe = _value
@ -31,8 +32,10 @@ var Oceantime:float
@onready var parentRigid:RigidBody3D = get_parent()
# 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:
@ -52,6 +55,8 @@ func _physics_process(_delta: float) -> void:
#parentRigid.gravity_scale = 0.3
#parentRigid.angular_damp = 15.0
parentRigid.apply_force(Vector3.UP * clamp(gravity * depth * float_force,-max_float_force,max_float_force) ,global_position-parentRigid.global_position)
if debug:
print(str(self)+" is applying a force of "+str(Vector3.UP * clamp(gravity * depth * float_force,-max_float_force,max_float_force) ,global_position-parentRigid.global_position)+"to "+str(parentRigid))
func _process(_delta: float) -> void:
if OceanNode != null:

View file

@ -54,7 +54,7 @@ shader_parameter/water_alpha_max = 15.0
shader_parameter/texture_normal = SubResource("NoiseTexture2D_d50os")
shader_parameter/texture_normal2 = SubResource("NoiseTexture2D_ca8p6")
shader_parameter/wave = SubResource("NoiseTexture2D_cuet1")
shader_parameter/wave_time = 23.9076
shader_parameter/wave_time = 13.1719
shader_parameter/wave_direction = Vector2(2, 0)
shader_parameter/wave_2_direction = Vector2(0, 0.9)
shader_parameter/time_scale = 0.02

File diff suppressed because it is too large Load diff

View file

@ -16,8 +16,11 @@ config/tags=PackedStringArray("games")
run/main_scene="uid://bhwuawppmqk4"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg"
window/stretch/mode="viewport"
window/stretch/aspect="expand"
[display]
window/size/viewport_width=360
window/size/viewport_height=240
[global_group]
@ -74,7 +77,3 @@ jolt_physics_3d/simulation/sleep_velocity_threshold=0.1
3d/sleep_threshold_angular=0.174533
common/physics_interpolation=true
common/enable_object_picking=false
[rendering]
scaling_3d/scale=0.4