ARKit-CoreLocation
ARKit-CoreLocation copied to clipboard
Nodes are moving with me with when I travel
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 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.
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.
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?
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...
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.
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.
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.
I use AROrientationTrackingConfiguration, because my nodes are all far away, there's no objects or planes close enough to give ARKit any positional awareness.
@halmueller I'm facing the same issue, POIs are moving with me. Was wondering how did you solve this ? Thanks
I'm facing this issue as well. I've also noticed that the nodes move even when I'm standing still (albeit slowly).
I am also having this issue, anyone have any luck?