fix: awp fov
This commit is contained in:
@@ -13,6 +13,7 @@ var _bob_timer: float = 0.0
|
||||
var _target_tilt: float = 0.0
|
||||
var _current_tilt: float = 0.0
|
||||
var _target_fov: float = 90.0
|
||||
var _weapon_fov_override: float = -1.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -59,6 +60,9 @@ func _process(delta: float) -> void:
|
||||
if hspeed > params.walk_speed * 1.5:
|
||||
_target_fov = params.dash_fov
|
||||
|
||||
if _weapon_fov_override > 0.0:
|
||||
_target_fov = _weapon_fov_override
|
||||
|
||||
camera.fov = lerpf(camera.fov, _target_fov, 1.0 - exp(-params.fov_lerp_speed * delta))
|
||||
|
||||
# ── Head bob ──────────────────────────────────────────────────────────
|
||||
@@ -89,6 +93,9 @@ func set_wall_tilt(side: float) -> void:
|
||||
else:
|
||||
_target_tilt = side * 12.0
|
||||
|
||||
func set_weapon_fov(fov: float) -> void:
|
||||
_weapon_fov_override = fov
|
||||
|
||||
|
||||
## Called to reset tilt (e.g., on landing).
|
||||
func clear_wall_tilt() -> void:
|
||||
|
||||
+10
-2
@@ -75,8 +75,14 @@ func _build_model() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
|
||||
if not visible:
|
||||
return
|
||||
|
||||
|
||||
if camera:
|
||||
camera.fov = lerpf(camera.fov, target_fov, 15.0 * delta)
|
||||
var rig = camera.get_parent()
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(ads_fov if is_ads else -1.0)
|
||||
|
||||
# Move model slightly based on ADS
|
||||
var target_pos = Vector3(0.0, -0.15, -0.6) if is_ads else Vector3(0.3, -0.3, -0.8)
|
||||
@@ -100,6 +106,8 @@ func _start_reload() -> void:
|
||||
func unequip() -> void:
|
||||
is_ads = false
|
||||
if camera:
|
||||
camera.fov = default_fov
|
||||
var rig = camera.get_parent()
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(-1.0)
|
||||
target_fov = default_fov
|
||||
position = Vector3(0.3, -0.3, -0.8)
|
||||
|
||||
+11
-3
@@ -87,9 +87,15 @@ func _build_model() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
|
||||
if not visible:
|
||||
return
|
||||
|
||||
|
||||
if camera:
|
||||
var target_fov = ads_fov if is_ads else default_fov
|
||||
camera.fov = lerpf(camera.fov, target_fov, 15.0 * delta)
|
||||
var target_fov = ads_fov if is_ads else -1.0
|
||||
var rig = camera.get_parent()
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(target_fov)
|
||||
|
||||
# Move model to center when ADS
|
||||
var target_pos = Vector3(0.0, -0.2, -0.5) if is_ads else Vector3(0.3, -0.3, -0.7)
|
||||
@@ -116,5 +122,7 @@ func _start_reload() -> void:
|
||||
func unequip() -> void:
|
||||
is_ads = false
|
||||
if camera:
|
||||
camera.fov = default_fov
|
||||
var rig = camera.get_parent()
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(-1.0)
|
||||
position = Vector3(0.3, -0.3, -0.7)
|
||||
|
||||
Reference in New Issue
Block a user