I'm having huge issues at placing a 3d model on a specific gps position. Before opening the AR ViewController im downloading the model which means I also have the file path to the model. I've tried different things to place the downloaded model on a fixed gps location in AR.
I'm using Project Dent to achieve this but I'm not sure if it is even possible with that library.
I've tried loading the model (usdz file) into a SCNNode and then attaching it to a LocationNode which I then add to the sceneLocationView.
// Load model
let model = MDLAsset(url: (self.arConfig?.models.first!)!)
model.loadTextures()
let modelNode: SCNNode = SCNNode(mdlObject: model.object(at: 0))
modelNode.scale = SCNVector3(x: 30, y: 30, z: 30)
// Create location node and add the model node to it
let locationNode = LocationNode(location: location)
locationNode.addChildNode(modelNode)
locationNode.continuallyUpdatePositionAndScale = true
locationNode.continuallyAdjustNodePositionWhenWithinRange = true
locationNode.scaleRelativeToDistance = true
locationNode.ignoreAltitude = true
// Add the location node for a given location which includes the model to the scene
sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: locationNode)
The result is that I'm able to see the model in front of my camera but it's not fixed to the specific location. It keeps moving with my camera when I move the camera up, to the side or go back a little.
I also looked into this answer. I used the code snippet for the "ThreeDNode" and tried initializing a SCNScene using the downloaded model which I then pass to the "ThreeDNode" class. I've tried initializing the scene using SCNScene(url, options) and converted the usdz file to a .scn file. However the scenes root node doesn't contain any geometry so the "ThreeDNode" class cannot set it to it's own.
I also searched for other frameworks which could help me achieve this but couldn't find any.