Skip to content

Instantly share code, notes, and snippets.

@tikimcfee
Created March 14, 2021 04:21
Show Gist options
  • Save tikimcfee/aba19ab6d9843ae41f9fa8fbd9191251 to your computer and use it in GitHub Desktop.
Save tikimcfee/aba19ab6d9843ae41f9fa8fbd9191251 to your computer and use it in GitHub Desktop.
Found on the net
let distanceConstraint = SCNDistanceConstraint(target: box)
distanceConstraint.minimumDistance = 55
distanceConstraint.maximumDistance = 60
let lookAtConstraint = SCNLookAtConstraint(target: box)
lookAtConstraint.isGimbalLockEnabled = true
cameraNode.constraints = [lookAtConstraint,distanceConstraint]
scnView.scene?.rootNode.addChildNode(cameraNode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment