Camera controls don't use delta factor (prevents jitter at low framerates)

This commit is contained in:
Rob Kelly 2024-12-30 15:13:24 -07:00
parent 0fc25d753f
commit 7d9c6997bc
4 changed files with 9 additions and 10 deletions

View File

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

View File

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

View File

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

View File

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