19 lines
611 B
GDScript
19 lines
611 B
GDScript
extends Camera3D
|
|
|
|
@onready var game = get_parent()
|
|
@onready var camera_zones = game.get_node("CameraZones")
|
|
@onready var player = game.get_node("Player")
|
|
@onready var offset = position - player.position
|
|
|
|
func _ready() -> void:
|
|
pass
|
|
|
|
func _process(delta: float) -> void:
|
|
var goal_position = player.get_node("Collision").global_position + offset
|
|
|
|
global_position = lerp(global_position, goal_position, min(delta * 4, 1.0))
|
|
|
|
for n in camera_zones.get_children():
|
|
if player in n.get_overlapping_bodies():
|
|
offset = n.get_node("Offset/Camera").position
|
|
rotation = n.get_node("Offset/Camera").rotation
|