【ARKit】3D空間座標をスクリーン座標に変換する
ARの空間座標をスクリーン座標に変換する関数を紹介します。
ARSCNViewのprojectPointで取得できます。
下記ソースです。
func getScreenPointfromARPos(sceneView:ARSCNView , pos:SCNVector3) -> CGPoint { let screenPos = sceneView.projectPoint(pos) let point = CGPoint(x: CGFloat(screenPos.x), y: CGFloat(screenPos.y)) return point }