I am using SceneView for accessing the ARCore Geospatial API.
When I create several EarthAnchors with
val earth = arSceneView.session?.earth ?: return
if (earth.trackingState == TrackingState.TRACKING) {
// Place the earth anchor at the same altitude as that of the camera to make it easier to view.
val altitude = earth.cameraGeospatialPose.altitudeMeters - 1
val rotation = Rotation(0f, 0f, 0f)
// Put the anchor somewhere around the user.
val latitude = earth.cameraGeospatialPose.latitude + 0.0004
val longitude = earth.cameraGeospatialPose.longitude + 0.0004
earthAnchor = earth.createAnchor(latitude, longitude, altitude, rotation)
}
// Attach the anchor to the arModelNode.
arModelNode.anchor = earthAnchor
everything works fine. But when I call ARSession getAllAnchors the order has changed.
Instead of the order I had while creating them (1, 2, 3), I get (1, 3, 2). Is there any way I can get the anchors in the same order I created them?