lobby cam

This commit is contained in:
2026-08-27 21:34:18 +03:00
parent 170d8ff3f1
commit 32ac46f840
4 changed files with 23 additions and 3 deletions
+15 -3
View File
@@ -1,3 +1,4 @@
class_name IsoCamera
extends Camera3D
@export var height: float = 25.0
@@ -16,6 +17,11 @@ var _shake_amount: float = 0.0
var _shake_decay: float = 0.0
var _user_fov: float = 0.0
# Per-level framing multiplier: 1.0 = the designer's base shot, >1 dollies the camera
# back for a wider view (the lobby uses this). Set by game_shell when a level loads;
# kept separate from the scroll-wheel FOV zoom so the two don't fight.
var _framing_scale: float = 1.0
# Trailing-camera state: _focus is the smoothed point the camera frames (it lags
# the bull), _drag_offset is the velocity-driven trail that slides it behind.
var _focus: Vector3 = Vector3.ZERO
@@ -51,15 +57,21 @@ func adjust_zoom(ratio: float) -> void:
_user_fov = clampf(_user_fov / ratio, fov_min, fov_max)
## Dolly the camera in/out for the level being loaded. 1.0 is the base framing; >1 pulls
## back for a wider shot (the lobby hub uses this). Independent of the scroll-wheel zoom.
func set_framing_scale(scale: float) -> void:
_framing_scale = maxf(scale, 0.1)
func _process(delta: float) -> void:
fov = lerpf(fov, _user_fov, delta * 8.0)
var angle_rad := deg_to_rad(horizontal_angle_deg)
var offset := Vector3(
sin(angle_rad) * horizontal_distance,
height,
cos(angle_rad) * horizontal_distance
sin(angle_rad) * horizontal_distance * _framing_scale,
height * _framing_scale,
cos(angle_rad) * horizontal_distance * _framing_scale
)
var target := get_parent() as Node3D