Chnage pixelization mode

Now using SubViewport shrink to make UI not affected by pixelization
This commit is contained in:
Lucas 2025-04-07 12:31:57 +02:00
parent 913772ece1
commit 4eafcb6a8d
No known key found for this signature in database
6 changed files with 603 additions and 538 deletions

1
.gitignore vendored
View file

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

View file

@ -2,18 +2,22 @@
extends RigidBody3D
class_name Boat
@export var max_thrust_force: float = 2048*3.0
@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
var cam_rotation: Vector3
var is_docked: bool = false
var submerged := false
func _ready():
add_to_group("Boats",true)
add_to_group("Boats", true)
func _process(_delta):
@ -24,32 +28,37 @@ 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 += Vector3(0.0, 1.0, 0.0) * _delta
if Input.get_action_strength("camera_right") > 0.0:
cam_rotation += Vector3(0.0,-1.0,0.0)*_delta
cam_rotation += Vector3(0.0, -1.0, 0.0) * _delta
$CamRoot.global_rotation = cam_rotation
$CamRoot.global_position.y = 0.0
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)
apply_torque(global_transform.basis.y.normalized() * steering * clamp(Input.get_action_strength("move_forward"),0.35,1.0) ) # for sideways motion
## 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(linear_velocity.length(), 0.35, 1.0)) # for sideways motion
reset_forces()
func thrust(_strength:=1.0):
func thrust(_strength := 1.0):
if not is_docked:
thrust_force = max_thrust_force * _strength
func steer_right(_strength:=1.0):
func steer_right(_strength := 1.0):
if not is_docked:
steering = -PI * max_steering
steering = - PI * max_steering
func steer_left(_strength:=1.0):
func steer_left(_strength := 1.0):
if not is_docked:
steering = PI * max_steering

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

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