So using the script exactly like Bram the aiming does not work at all.
After modifying it a bit by swapping weapon_camera_fov
for weapon_camera.fov
made it work as intended when pressing the button but now there is an issue that when loading in to the sandbox the camera spazzes out and zooms in and out during the first few frames.
I tried moving and swapping some lines but it either completely breaks the aiming function or still causes the jittering zoom in and out on load issue.
func _process(delta: float) -> void:
if Input.is_action_pressed("aim"):
smooth_camera.fov = lerp(smooth_camera.fov, smooth_camera_fov * aim_multiplier, delta * 15)
weapon_camera.fov = lerp(weapon_camera.fov, weapon_camera_fov * aim_multiplier, delta * 10)
else:
smooth_camera.fov = lerp(smooth_camera_fov, smooth_camera.fov * aim_multiplier, delta * 25)
weapon_camera.fov = lerp(weapon_camera_fov, weapon_camera.fov * aim_multiplier, delta * 20)