Xcode:12.5
iOS:14.5
I updated the latest version.
In the previous version. I blocked the anchor image with my hand, audioEntity has been kept in the AR scene.
But now, I blocked the anchor image with my hand, audioEntity will disappear. Why?
How do I achieve the previous effect?
func session(_ session: ARSession, didAdd anchors: [ARAnchor])
{
anchors.compactMap { $0 as? ARImageAnchor }.forEach {
rootAnchor = AnchorEntity(anchor: $0)
arView.scene.addAnchor(rootAnchor)
add()
}
}
fileprivate func add()
{
let audioPlane = MeshResource.generatePlane(width: 0.2, height: 0.2, cornerRadius: 0)
var audioMtl = SimpleMaterial()
do {
audioMtl.baseColor = try MaterialColorParameter.texture(TextureResource.load(named: "audio_play.png"))
} catch {
}
let audioEntity = ModelEntity(mesh: audioPlane, materials: [audioMtl])
audioEntity.position = [0, 0.1, 0]
rootAnchor.addChild(audioEntity)
}
2
0
1.3k