In ARKit there's a ARSessionDelegate protocol what has 4 main methods you can implement to receive captured video frame images and tracking state from an AR session.

Does ARCore API have a similar protocol (interface) with similar methods?

protocol ARSessionDelegate

override func viewDidLoad() {  
      sceneView.session.delegate = self
  1. This method provides a newly captured ARCamera image and accompanying AR information to the delegate:
func session(ARSession, didUpdate: ARFrame) { ... }
  1. This method tells the delegate that one or more ARAnchors have been added to the session:
func session(ARSession, didAdd: [ARAnchor]) { ... }
  1. This method tells the delegate that the ARSession has adjusted the properties of one or more ARAnchors:
func session(ARSession, didUpdate: [ARAnchor]) { ... }
  1. This method tells the delegate that one or more ARAnchors have been removed from the ARSession:
func session(ARSession, didRemove: [ARAnchor]) { ... }

If similar methods (even not all of them) exist in ARCore, please show me how they look like using Kotlin code.

Any help appreciated.

1 Answers

ARGeo On Best Solutions

After going through an ARCore documentation I discovered at least two similar methods:

First: This method is used for receiving a new camera frame, updating the location of the device, updating the location of tracking anchors, updating detected planes, etc.

ArStatus ArSession_update(ArSession *session, ArFrame *out_frame)

Second: This method defines a tracked location in the physical world:

ArStatus ArSession_acquireNewAnchor(ArSession *session, const ArPose *pose, ArAnchor **out_anchor)