ARKit-CoreLocation icon indicating copy to clipboard operation
ARKit-CoreLocation copied to clipboard

Nodes are moving with me with when I travel

Open ahsanghauri opened this issue 5 years ago • 11 comments

when I move all nodes are move with me where I travel please help me Here is my code:

func ARINIT() { var location = CLLocation(coordinate: CLLocationCoordinate2D(latitude: 33.54981128339599, longitude: 73.12484017688058), altitude: 100) // ISKPRO let image = UIImage(named: "pin")! var annotationNode = LocationAnnotationNode(location: location, image: image) annotationNode.annotationNode.name = "ISKPRO" annotationNode.scaleRelativeToDistance = true sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationNode)

    location  = CLLocation(coordinate: CLLocationCoordinate2D(latitude: 33.5498046875, longitude: 73.12484017688058), altitude: 100) // Un named next to ISKPRO
    annotationNode = LocationAnnotationNode(location: location, image: image)
    annotationNode.annotationNode.name = "Next to ISKPRO"
    sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationNode)

    location  = CLLocation(coordinate: CLLocationCoordinate2D(latitude: 33.6101371, longitude: 73.3433248), altitude: 100) // R Systems
    annotationNode = LocationAnnotationNode(location: location, image: image)
    annotationNode.annotationNode.name = "R Systems"
    sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationNode)

}

ahsanghauri avatar Sep 07 '19 10:09 ahsanghauri

@ahsanghauri try double checking your target's location permissions. Make sure you've added NSLocationWhenInUseUsageDescription to your target's info.plist.

LocationAnnotationNode doesn't provide any warnings if locationManager.currentLocation is nil, it just returns out of the updatePositionAndScale function.

rally-john avatar Sep 26 '19 22:09 rally-john

I'm also getting this too. I can confirm that I have the NSLocationWhenInUseUsageDescription added but I have only noticed it since adding annotationNode.scaleRelativeToDistance to be true.

aduuub avatar Sep 30 '19 22:09 aduuub

How far are you from the nodes you're adding? How far are you moving from initial point after adding nodes? Does it make a difference if you change the node's .scalingScheme to something other than the default?

halmueller avatar Oct 01 '19 04:10 halmueller

Between 3m and 200m. When looking at the distance to the node from the current location it appears accurate. Although, the image itself appears clustered close to the user and follows them.

I have tried different scaling schemes including both cases of scaleRelativeToDistance too but haven't had any luck...

RPReplay_Final1570395556.MP4.zip

aduuub avatar Oct 06 '19 23:10 aduuub

I don't understand what's going on, but I just saw a repro in the demo code I've been working on. You can see it in the moreDemos branch of my fork, at https://github.com/halmueller/ARKit-CoreLocation/tree/moreDemos. Run the "Field of Nodes" or "Field of Labels" demo. The entire grid of nodes drifts in the direction I walk. I eventually make some progress but the nodes are moving too.

halmueller avatar Oct 07 '19 00:10 halmueller

I just had a very clear repro of this issue.

I started an ARCL view at a place that's 480 meters east of me, 1600 meters south, and 60-70 meters lower in elevation.

When I arrived home, the sceneLocationView.sceneLocationManager.bestLocationEstimate had me at x=1107, y=642, z=5249. The sceneLocationView.currentScenePosition was the same (to within 5 decimal places).

I believe, but cannot yet prove, that there's a problem with the handling of location updates, and that the projection of node locations is probably correct.

Pull the demo from my fork to give it a try. I'm not yet ready to submit a PR on this work.

halmueller avatar Oct 07 '19 09:10 halmueller

After working with the new demo a bit...I suggest you try twiddling the SceneLocationView's locationEstimateMethod and arTrackingType. I don't understand these settings completely but I think they could be responsible for the behavior we're seeing. New demo is up as a PR; grab it and go for a walk.

halmueller avatar Oct 08 '19 06:10 halmueller

I use AROrientationTrackingConfiguration, because my nodes are all far away, there's no objects or planes close enough to give ARKit any positional awareness.

Pilot-Marc avatar Oct 08 '19 11:10 Pilot-Marc

@halmueller I'm facing the same issue, POIs are moving with me. Was wondering how did you solve this ? Thanks

jeromeDms avatar Jan 28 '20 17:01 jeromeDms

I'm facing this issue as well. I've also noticed that the nodes move even when I'm standing still (albeit slowly).

ngoan avatar Apr 26 '20 23:04 ngoan

I am also having this issue, anyone have any luck?

JackSoby avatar Oct 29 '20 02:10 JackSoby