Last active
May 7, 2018 02:18
-
-
Save fisherds/a2a75c914c293213f594daf5fd940d3d to your computer and use it in GitHub Desktop.
snippet of code for getting the position of the camera that I don't want you to bother type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func pressedAddEarth(_ sender: Any) { | |
guard let pointOfView = sceneView.pointOfView else {return} | |
let transform = pointOfView.transform | |
let orientation = SCNVector3(-transform.m31, -transform.m32, -transform.m33) | |
let location = SCNVector3(transform.m41, transform.m42, transform.m43) | |
let currentPositionOfCamera = orientation + location | |
// other stuff | |
} | |
func +(left: SCNVector3, right: SCNVector3) -> SCNVector3 { | |
return SCNVector3Make(left.x + right.x, left.y + right.y, left.z + right.z) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment