2020-02-01 16:06:53 +01:00
|
|
|
extends Spatial
|
|
|
|
|
|
|
|
onready var camera = get_node("Camera")
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
2020-02-01 22:49:37 +01:00
|
|
|
var player1 = get_parent().get_child(3)
|
|
|
|
var player2 = get_parent().get_child(4)
|
|
|
|
|
|
|
|
if not player1 and player2: return
|
|
|
|
|
2020-02-01 16:06:53 +01:00
|
|
|
var center = player2.transform.origin + (player1.transform.origin - player2.transform.origin) / 2.0
|
|
|
|
var distance = (player1.transform.origin - player2.transform.origin).length()
|
|
|
|
|
|
|
|
camera.fov = distance + 50.0
|
|
|
|
|
|
|
|
transform.origin = center
|