Search code examples
swiftaugmented-realityscenekitarkitrealitykit

ARKit – Anchoring without Plane Detection and Hit-Testing


This is a follow up question to one of my previous posts. Currently, I am placing a SCNNode at a known coordinate in the real world. My application requires the user to avoid using plane detection or a hit-test, rather that they can place an object at a known coordinate and hope it stays anchored at that position.

Currently, the performance of the anchoring is suboptimal and I would like to find ways in order to improve it. I am up for any suggestions if possible.

Thanks in advance!


Solution

  • ARKit 4.0 solution

    In the latest version of ARKit there are GPS location anchors called ARGeoAnchor (which works thanks to the implementation of CoreLocation framework) that uses familiar initializer:

    @nonobjc convenience init(coordinate: CLLocationCoordinate2D, 
                                altitude: CLLocationDistance?)
    

    ARKit 3.0 solution

    Of course, you can place a model in AR scene without plane detection and hit-testing/ray-casting, although this might cause some AR anomalies – your model might be placed below scene's grid or model might be placed at a wrong location what leads to incorrect parallax.

    There's one thing your scene must always have – an anchor for your model. Without that anchor your model may float in a scene what leads to poor user experience. In plane detection's case you automatically get ARPlaneAnchor tethered to invisible plane.

    Thus, let's see what approaches you have to implement to get a robust AR experience, even if you do not use a plane detection and hit-testing:

    You can use these approaches separately or in combination.

    But there is one unpleasant thing you must know about – a working distance for models in ARKit / SceneKit is up to 1000 meters. If your model goes beyond that limit you'll get flickering artifacts.