[swift] scenekit / 現在のカメラの位置・撮影方向を取得する

scenekit / 現在のカメラの位置・撮影方向を取得するには、sceneViewのpointOfViewから取得することができる。

 

print("Camera position: \(scnView.pointOfView?.position.x) \(scnView.pointOfView?.position.y) \(scnView.pointOfView?.position.z)")
        
        print("Camera rotation: \(scnView.pointOfView?.rotation.x) \(scnView.pointOfView?.rotation.y) \(scnView.pointOfView?.rotation.z) \(scnView.pointOfView?.rotation.w)")
        
        print("Camera orientat: \(scnView.pointOfView?.orientation.x) \(scnView.pointOfView?.orientation.y) \(scnView.pointOfView?.orientation.z) \(scnView.pointOfView?.orientation.w)")

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です