From 7d9c6997bc5f2158601d8d652f31174f9ecd24cc Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Mon, 30 Dec 2024 15:13:24 -0700 Subject: [PATCH] Camera controls don't use delta factor (prevents jitter at low framerates) --- project.godot | 1 - src/player/shot_setup/shot_setup.gd | 10 +++++----- src/ui/camera/free_camera/free_camera.gd | 6 +++--- src/ui/menus/title_screen/title_screen.tscn | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/project.godot b/project.godot index 78ea718..bc989cf 100644 --- a/project.godot +++ b/project.godot @@ -17,7 +17,6 @@ run/main_scene="res://src/game/game.tscn" config/use_custom_user_dir=true config/project_settings_override="user://settings.godot" config/features=PackedStringArray("4.3", "Forward Plus") -run/max_fps=60 [autoload] diff --git a/src/player/shot_setup/shot_setup.gd b/src/player/shot_setup/shot_setup.gd index af11ea0..16c3a50 100644 --- a/src/player/shot_setup/shot_setup.gd +++ b/src/player/shot_setup/shot_setup.gd @@ -534,7 +534,7 @@ func _on_game_ball_changed(ball: GameBall) -> void: player_offset.position.z = z_offset -func _process(delta: float) -> void: +func _process(_delta: float) -> void: # REMOVEME if Input.is_action_just_pressed("ui_menu"): print("Debugging...") @@ -544,19 +544,19 @@ func _process(delta: float) -> void: ## Visual updates # Rotation direction.rotation.y = lerp_angle( - direction.rotation.y, _target_rotation.y, delta * Game.settings.x_acceleration + direction.rotation.y, _target_rotation.y, Game.settings.x_acceleration / 60.0 ) pitch.rotation.x = lerp_angle( - pitch.rotation.x, _target_rotation.x, delta * Game.settings.y_acceleration + pitch.rotation.x, _target_rotation.x, Game.settings.y_acceleration / 60.0 ) # Arrow lags behind camera control arrow_pivot.rotation.y = lerp_angle( - arrow_pivot.rotation.y, _target_rotation.y, delta * ARROW_ACCELERATION + arrow_pivot.rotation.y, _target_rotation.y, ARROW_ACCELERATION / 60.0 ) # Player lags further behind player_pivot.rotation.y = lerp_angle( - player_pivot.rotation.y, _target_rotation.y, delta * PLAYER_ACCELERATION + player_pivot.rotation.y, _target_rotation.y, PLAYER_ACCELERATION / 60.0 ) ## Input Handling diff --git a/src/ui/camera/free_camera/free_camera.gd b/src/ui/camera/free_camera/free_camera.gd index dd62bb8..a8f6bbf 100644 --- a/src/ui/camera/free_camera/free_camera.gd +++ b/src/ui/camera/free_camera/free_camera.gd @@ -31,10 +31,10 @@ func camera_motion(motion: Vector2) -> void: ) -func _physics_process(delta: float) -> void: +func _physics_process(_delta: float) -> void: # Rotation - rotation.y = lerp_angle(rotation.y, _target.y, delta * Game.settings.x_acceleration) - rotation.x = lerp_angle(rotation.x, _target.x, delta * Game.settings.y_acceleration) + rotation.y = lerp_angle(rotation.y, _target.y, Game.settings.x_acceleration / 60.0) + rotation.x = lerp_angle(rotation.x, _target.x, Game.settings.y_acceleration / 60.0) # Handle spatial movement var xz_input := Input.get_vector("camera_left", "camera_right", "camera_forward", "camera_back") diff --git a/src/ui/menus/title_screen/title_screen.tscn b/src/ui/menus/title_screen/title_screen.tscn index 87b6c28..c567cf4 100644 --- a/src/ui/menus/title_screen/title_screen.tscn +++ b/src/ui/menus/title_screen/title_screen.tscn @@ -1482,7 +1482,7 @@ grow_horizontal = 2 grow_vertical = 2 [node name="PressStart" type="Label" parent="Menu"] -modulate = Color(1, 1, 1, 0.98649) +modulate = Color(1, 1, 1, 0.899996) layout_mode = 1 anchors_preset = 8 anchor_left = 0.5