Untitled

 avatar
unknown
plain_text
5 months ago
1.9 kB
5
Indexable
   onSessionUpdated = {session: Session, updatedFrame: Frame ->
                  frame = updatedFrame

                  destinationAnchor?.detach()
                  destinationAnchor = null
                  val earth = session.earth
                  if (earth?.earthState == Earth.EarthState.ENABLED) {

                      if (destinationAnchor == null) {
                          val cpose = earth.cameraGeospatialPose
                          val lat = cpose.latitude
                          val long = cpose.longitude
                          val latlong = LatLng(lat,long)

                          destinationAnchor =
                              createDestinationAnchor(earth, latlong)?.also { anchor ->
                                  childNodes += createAnchorNode(
                                      engine = engine,
                                      modelLoader = modelLoader,
                                      materialLoader = materialLoader,
                                      anchor = anchor
                                  )
                              }

                      }
                  }
              },

   onSessionCreated = {session: Session ->

         val earth = session.earth
         if (earth?.earthState == Earth.EarthState.ENABLED) {

                 latlongpointslist.forEach { latLng ->

                      destinationAnchor =
                          createDestinationAnchor(earth, latLng)?.also { anchor ->
                              childNodes += createAnchorNode(
                                  engine = engine,
                                  modelLoader = modelLoader,
                                  materialLoader = materialLoader,
                                  anchor = anchor
                              )
                          }
                  }
             }
         },
Editor is loading...
Leave a Comment