I am following the code from WWDC 2017: https://www.youtube.com/watch?v=ijsXzvif4vs
When the sceneView.snapshot displays the plane on the screen, it is already rotated 90 degrees. I am holding the phone in portrait mode.
private func capturePhoto() {
guard let currentFrame = self.sceneView.session.currentFrame else {
return
}
let photoPlaneNode = PhotoPlane(image: self.sceneView.snapshot())
photoPlaneNode.eulerAngles.z = (Float.pi) * (-1)
var translation = matrix_identity_float4x4
translation.columns.3.z = -1.0
photoPlaneNode.simdTransform = matrix_multiply(currentFrame.camera.transform,translation)
self.sceneView.scene.rootNode.addChildNode(photoPlaneNode)
}
Any ideas?