18 lines
441 B
GDScript
18 lines
441 B
GDScript
extends Camera3D
|
|
|
|
@export var focus_point := Vector3(0.0, 2.0, 0.0)
|
|
@export var orbit_speed := 0.025
|
|
@export var animate_orbit := true
|
|
|
|
func _ready() -> void:
|
|
look_at(focus_point, Vector3.UP)
|
|
|
|
func _process(delta: float) -> void:
|
|
if not animate_orbit:
|
|
return
|
|
|
|
var offset := global_position - focus_point
|
|
offset = offset.rotated(Vector3.UP, orbit_speed * delta)
|
|
global_position = focus_point + offset
|
|
look_at(focus_point, Vector3.UP)
|