ARKIT
Below code works fine with iPhone with iOS version 15.6.
Also instead of assigning url to the material contents, if I use default image from resources its loading on time.
Tag: ProcessRaycastResults
private func setVirtualObject3DPosition(_ results: [ARRaycastResult], with virtualObject: VirtualObject) {
guard let result = results.first else {
print("Unexpected case: the update handler is always supposed to return at least one result.")
return;
}
self.setTransform(of: virtualObject, with: result)
// If the virtual object is not yet in the scene, add it.
if virtualObject.parent == nil {
self.childNodesPortal = virtualObject.childNodes
self.getMatrials(scene: virtualObject.childNodes)
}
}
func getMatrials(scene:[SCNNode]){
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5 ) {
for child in scene {
material.diffuse.contents = "https//xyz.png"
material.normal.contents = "https//xss.png"
//setting here materials with the png images from url.
}
}
}
Ios version 16 causing delay for image assignment for the virtual object.
Anyone could suggest why there is variation for iOS v16 and what workaround I should do.
Thanks in advance.