16 lines
519 B
GDScript
16 lines
519 B
GDScript
extends Node
|
|
|
|
onready var camera = get_parent()
|
|
onready var OnFootPhysics = get_node("../../../../../OnFootPhysics")
|
|
onready var default_fov = camera.fov
|
|
onready var max_fov = default_fov + 20
|
|
var min_speed = 0.5
|
|
|
|
func _process(_delta):
|
|
if OnFootPhysics.velocity.y >= 0.0:
|
|
return
|
|
var terminal_velocity = -OnFootPhysics.get_terminal_falling_velocity()
|
|
var speed = -OnFootPhysics.velocity.y
|
|
var weight = (terminal_velocity - speed) / (terminal_velocity - min_speed)
|
|
camera.fov = lerp(max_fov, default_fov, weight)
|