ARKit-CoreLocation
ARKit-CoreLocation copied to clipboard
Decrease radius to only show nearest objects
Basically title. I'd like to load some pins and only show the ones relative to my position until a certain range (< 3km).
did you found any solution for this
You can check the distance to the nodes and hides all that situated is too far away, for example
maxDistance: Double = 3000
sceneLocationView.locationNodes.forEach{
let p = $0.position
let distance: Double = Double(sqrt(pow(p.x, 2) + pow(p.y, 2) + pow(p.z, 2)))
$0.isHidden = distance < maxDistance
}`
This absolutely can be done in "your" app, but I can see how this feature would be really nice to have in the library.
For a nice touch, this can be animated ...
sceneLocationView.locationNodes.forEach {
let p = $0.position
SCNTransaction.animationDuration = 0.25
let distance: Double = Double(sqrt(pow(p.x, 2) + pow(p.y, 2) + pow(p.z, 2)))
$0.opacity = (distance < maxDistance ? 1 : 0)
}