I've created a scene with RealityComposer (tracking an image, not plane) an placed a cube on top.
Then I've imported the scene into my ARView. (my Anchor is named "MainScene")...
Now I'm loading the scene an append it to ARView's session:
myAnchor = try? AR.loadMainScene()
arView.scene.anchors.append(myAnchor!)
Now everything works fine !
I'm trying to enable / disable the attached scene if tracking is successfull or not:
func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
for anch in anchors
{
guard let imageAnchor = anch as? ARImageAnchor else { return }
if(imageAnchor.isTracked)
{
//enable scene
}
else
{
//disable scene
}
}
}
How to do it ?