Place object at a fixed 3D location

I created a default Xcode ARKit App. When I ran it, I could see the spaceship object. I could also walk around it and watched it from different angles. Now I added my own 3D object model, downloaded from https://www.turbosquid.com/3d-models/free-billboard-games-3d-model/1129110. It showed up in my App. If I walked around it, however, the object was also moviing. So I could not see it's back side. Why? Is there any configuration I need to set on the model file?

Replies

I am not good at models, just guess that the spaceship has a special node to set up the 3d world thus you can add it directly to the scene view. In other hand, normal models have not that special node, you should do more works to add it into sceneview.

Bellow is the code to load and add a model (obj, dae) - it is mainly based on the example ARKitExample:


guard let virtualObjectScene = SCNScene(named: "\(modelName).\(fileExtension)", inDirectory: "Models.scnassets/\(modelName)") else {

return

}


let wrapperNode = SCNNode()


for child in virtualObjectScene.rootNode.childNodes {

wrapperNode.addChildNode(child)

}


sceneView.scene.rootNode.addChildNode(wrapperNode)

Essentially you need to either create a node for your model and let it teleport to the location you tap or create a copy of the object at the location you tap. There is a great tutorial for beginners I used to learn this here http://jamesonquave.com/blog/arkit-tutorial-in-swift-4-for-xcode-9-using-scenekit/


Just do the whole thing as a new project, it takes literally 10 minutes.

Here is the answer!:

https://stackoverflow.com/a/73655218/17992581