我想将场景的摄像机限制在播放器上。
以下代码不起作用。当玩家移动时,相机只是静止不动:
let mainCamera = SKCameraNode()
let range = SKRange(lowerLimit: 0, upperLimit: 0)
let constraint = SKConstraint.distance(range, to: player)
constraint.enabled = true
mainCamera.constraints = [constraint]
camera = mainCamera
为什么这不起作用?