I would like to create a new SceneKit node when the user taps the screen, and have it appear directly in front of the camera at a set distance. For testing, this will be a S
Making it simple:
let constraint = SCNTransformConstraint(inWorldSpace: true) { node, transform -> SCNMatrix4 in
let distance: Float = 1.0
let newNode = SCNNode()
let worldFront = self.sceneView!.pointOfView!.simdWorldFront * distance
newNode.transform = self.sceneView!.pointOfView!.transform
newNode.transform = SCNMatrix4Translate(newNode.transform, worldFront.x, worldFront.y, worldFront.z)
return newNode.transform
}