extends Node3D


@export var background_speed: float
@export var far_speed: float
@export var near_speed: float

@onready var speeds = [background_speed, far_speed, near_speed]

@onready var meshes = [$BackgroundMesh, $FarMesh, $NearMesh]

@onready var camera = get_tree().get_current_scene().get_node("Camera3D")

func _process(_delta: float) -> void:
	global_position.x = camera.global_position.x
	for i in range(meshes.size()):
		meshes[i].mesh.surface_get_material(0).set_shader_parameter("uv_offset", Vector2(global_position.x * speeds[i], 0))
