如何将相机坐标转换为场景坐标-space?

How to convert camera coordinates to coordinate-space of scene?

我试图在我制作的场景中找到相机的坐标,但我最终得到的是不同系统中的坐标。坐标如(0.0134094329550862,在Scene Coordinate System中大约是1cm,而移动不止于此。

我这样做是为了获取坐标:

let cameraCoordinates = self.sceneView.pointOfView?.worldPosition

self.POSx = Double((cameraCoordinates?.x)!)
self.POSy = Double((cameraCoordinates?.y)!)
self.POSz = Double((cameraCoordinates?.z)!)

这就是我找到相机坐标及其方向的方式。

func getUserVector() -> (SCNVector3, SCNVector3) {
    if let frame = self.sceneView.session.currentFrame {
        let mat = SCNMatrix4(frame.camera.transform)
        let dir = SCNVector3(-1 * mat.m31, -1 * mat.m32, -1 * mat.m33)
        let pos = SCNVector3(mat.m41, mat.m42, mat.m43)
        return (dir, pos)
    }
    return (SCNVector3(0, 0, -1), SCNVector3(0, 0, -0.2))
}