camera.transform 和 pointOfView 有什么区别
What is the difference between camera.transform and pointOfView
为了将物体放在相机前面,我看到有两种方法:使用 camera.transform
和 pointOfView
camera.transform 来自 SCNView
和 scnView.session.currentFrame.camera.transform
https://developer.apple.com/documentation/arkit/arcamera
The position and orientation of the camera in world coordinate space.
这里是使用方法
var translation = matrix_identity_float4x4
translation.columns.3.z = -2
node.simdTransform = matrix_multiply(currentFrame.camera.transform, translation)
pointOfView 来自 SCNView
和 scnView.pointOfView
https://developer.apple.com/documentation/scenekit/scnscenerenderer/1523982-pointofview
The node from which the scene’s contents are viewed for rendering
下面是使用方法,使用convertPosition
转换为世界坐标
let camera = scnView.pointOfView!
let position = SCNVector3(x: 0, y: 0, z: -2)
node.position = camera.convertPosition(position, to: nil)
这两个有什么区别?两者似乎都指的是相机
为了将物体放在相机前面,我看到有两种方法:使用 camera.transform
和 pointOfView
camera.transform 来自 SCNView
和 scnView.session.currentFrame.camera.transform
https://developer.apple.com/documentation/arkit/arcamera
The position and orientation of the camera in world coordinate space.
这里是使用方法
var translation = matrix_identity_float4x4
translation.columns.3.z = -2
node.simdTransform = matrix_multiply(currentFrame.camera.transform, translation)
pointOfView 来自 SCNView
和 scnView.pointOfView
https://developer.apple.com/documentation/scenekit/scnscenerenderer/1523982-pointofview
The node from which the scene’s contents are viewed for rendering
下面是使用方法,使用convertPosition
转换为世界坐标
let camera = scnView.pointOfView!
let position = SCNVector3(x: 0, y: 0, z: -2)
node.position = camera.convertPosition(position, to: nil)
这两个有什么区别?两者似乎都指的是相机