How can I effectively calculate relative position and rotation to a transform?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ssach

I am attempting to create portals in Godot, and I am having trouble placing a camera near my second portal to render a viewport on my first. I am trying to use my player’s relative coordinate position and rotation to my first portal in order to get where the camera should be near the second portal. However, my current issue is that when attempting to first find my characters relative position to the first portal, I am finding incorrect relative coordinates.

I used the documentation to arrive at this method for getting my relative coordinates.

var playerCamXform = $Player/Camera3D.global_transform
var portalXform = $PortalFrame/PortalView.global_transform
print(playerCamXform.origin * portalXform)

which returned (0, 0, 1.35)

This was strange because I placed my playerCam 5 units away from the portal viewport, which I verified with:

print(portalXform.origin - playerCamXform.origin)
This returned (5,0,0).

I am unsure how to proceed and any help would be appreciated.