tool
extends Camera


func _ready():
	_on_view_transform_changed(Transform.IDENTITY)


func _on_view_transform_changed(new_transform: Transform2D):
	var tran = Transform.IDENTITY
	tran.origin.y = 0.5
	tran = tran.scaled(Vector3(0.2, 0.8, 1.0))
	var rid = VisualServer.camera_create()
	var basis_scale = tran.basis.get_scale()
	var scale = lerp(basis_scale.x, basis_scale.y, 0.5)
	VisualServer.camera_set_orthogonal(rid, 1.0 / scale, 0.0, 500.0)
	VisualServer.camera_set_transform(rid, tran)#Transform(new_transform))
	VisualServer.viewport_attach_camera(get_viewport().get_viewport_rid(), rid)
	
#	var tran = Transform2D.IDENTITY
#	tran.y.y = -2.0
#	get_viewport().global_canvas_transform = tran
	pass
