0
如何根据移动球体的x位置移动摄像机,但同时忽略该球体的y和z坐标?这里是我的下面就其3名维球体代码:SceneKit相机仅在x轴上跟随物体? - Swift
let cameraNode = SCNNode()
cameraNode.camera = SCNCamera()
cameraNode.camera?.usesOrthographicProjection = true
cameraNode.camera?.orthographicScale = 2
let constraint = SCNLookAtConstraint(target: sphere)
constraint.gimbalLockEnabled = true
self.cameraNode.constraints = [constraint]
cameraNode.position = SCNVector3Make(20, 20, 20)
cameraNode.eulerAngles = SCNVector3Make(0, 45, 0)
sphere.addChildNode(cameraNode)
如何我只是按照刚刚球体的x位置,而不是它的y和z位置呢?
您无法访问'cameraNode.position.x'并直接赋值吗? – codetiger