I have an Action Sequence
that has a duration of 0.5 and then gets hidden when it hits 0 secs:
How can know when the action is done so that I can remove it from the scene
? There isn't a way to do it with a SCNNode, I'm hoping an AnchorEntity
is different.
func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
for anchor in anchors {
if let anchorName = anchor.name, anchorName == "LaserBeam" {
placeObject(named: anchorName, for: anchor)
}
}
}
func placeObject(named entityName: String, for anchor: ARAnchor) {
do {
let laserEntity = try ModelEntity.load(named: entityName)
let anchorEntity = AnchorEntity(anchor: anchor)
anchorEntity.addChild(laserEntity)
arView.scene.addAnchor(anchorEntity)
} catch let err as NSError {
print(err.localizedDescription)
}
}