Created
October 21, 2022 13:15
-
-
Save wizard1066/d2a572d32ac7b2198fbe8acc1b66a52c to your computer and use it in GitHub Desktop.
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
func CGPointToSCNVector3(view: SCNView, depth: Float, point: CGPoint) -> SCNVector3 { | |
let projectedOrigin = view.projectPoint(SCNVector3Make(0, 0, depth)) | |
let locationWithz = SCNVector3Make(Float(point.x), Float(point.y), projectedOrigin.z) | |
return view.unprojectPoint(locationWithz) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment