Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as solved with 1 replies, 0 views
Sorry, I did it. problem is in this code
(https://stackoverflow.com/questions/33730468/how-to-convert-camera-extrinsic-matrix-to-scncamera-position-and-rotation)
private func updateNodeMatrix(_ camNode: SCNNode) {
guard let camera = camNode.camera else {
return
}
let modelMatrix = transform
let viewMatrix = SCNMatrix4Invert(camNode.transform) // invert is right
let projectionMatrix = camera.projectionTransform
let viewProjection = SCNMatrix4Mult(viewMatrix, projectionMatrix)
let modelViewProjection = SCNMatrix4Mult(modelMatrix, viewProjection)
nodeMatrix.modelViewProjectionTransform = float4x4(modelViewProjection)
}