Skip to content

How to use with Geospatial API #131

@lincollincol

Description

@lincollincol

Hey there! Thank you for this useful library which saves a lot of time when working with ARCore :)

I'm trying to create an android app that shows AR markers by specific location (LatLng). I'd like to create something like in this video (from README AR Geospatial API), but with simple ViewNode instead of ArModelNode.

I also can't place AR model at a specific location with a sample code from README. The model spawns just in front of the current camera position.

Here is my code:

val earth = binding.sceneView.arSession?.earth ?: return@launchWhenResumed
if (earth.trackingState == TrackingState.TRACKING) {
    val cameraGeospatialPose = earth.cameraGeospatialPose
    val earthAnchor = earth.createAnchor(49.844141, 24.024532, cameraGeospatialPose.altitude, 0f, 0f, 0f, 1f)
    val arModelNode = ArModelNode(
        context = this@MainActivity,
        lifecycle = lifecycle,
        modelFileLocation = "https://sceneview.github.io/assets/models/Gumball.glb"
    )
    arModelNode.anchor = earthAnchor
    binding.sceneView.addChild(arModelNode)
}

I would be grateful for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions