Drag ARKitSCNView to story builder or make in code
@IBOutlet weak var sceneView: ARSCNView!
let configuration = ARWorldTrackingConfiguration()
Add a configuration object to the view controller
let configuration = ARWorldTrackingConfiguration()
in view did load we configure the scene
self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints,.showWorldOrigin] // so it shows the axis origin and shows yellow feature points discovery
self.sceneView.session.run(configuration)
-+- |Green + Y axis up/down positive is up / negative down| |Red + X axis left/right positive is right / negative left| |Blus + Z axis away/towards positive is away / negative is closer| -+-
let node = SCNNode() // a node object (has not shape / size / color yet)
node.geometry = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0) // sizes are in meters
node.geometry?.firstMaterial?.diffuse.contents = UIColor.blue // give it a color
// up / down is Y
// left / right is X
// towards / away is Z (negative is behind the origin (away))
node.position = SCNVector3(0, 0, 0) // origin in respect to the parent node
self.sceneView.scene.rootNode.addChildNode(node)
node.removeFromParentNode()
self.sceneView.session.pause()
let n = self.sceneView.scene.rootNode
n.enumerateChildNodes { (node, _) in
node.removeFromParentNode()
}
self.sceneView.session.run(configuration, options: [.resetTracking,.removeExistingAnchors])