I've searched the internet for portal implementation in 3D, and I found a piece of code that I just don't understand. What is the purpose of this function and how does it work for updating the portal camera ?
func move_camera(portal: Node) -> void:
var linked: Node = links[portal] #this is the other portal
var trans: Transform = linked.global_transform.inverse() \
* get_camera().global_transform
var up := Vector3(0, 1, 0)
trans = trans.rotated(up, PI)
portal.get_node("CameraHolder").transform = trans
var cam_pos: Transform = portal.get_node("CameraHolder").global_transform
portal.get_node("Viewport/Camera").global_transform = trans