我正在开发一个iOS应用程序,我在屏幕上有一个节点,在4秒内缩小到空。我需要这个节点始终面对相机,所以我在目标节点上使用SCNBillboardConstraint()。但是,如果我使用缩放操作不再有效。我能做什么?
我的代码:
target.constraints = [SCNBillboardConstraint()]
let scale = CGFloat(0)
let action = SCNAction.scale(to: scale, duration: 4)
target.runAction(action)
使用以下代码,它工作正常:
let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!
let constraint = SCNBillboardConstraint()
ship.constraints = [SCNBillboardConstraint()]
ship.constraints?.append(constraint)
let scale = CGFloat(0.0)
let action = SCNAction.scale(to: scale, duration: 4)
ship.runAction(action)
希望这可以帮助。