简体   繁体   English

ARCore 有没有像 ARKit 那样的 session 委托方法?

[英]Does ARCore have session's delegate methods like ARKit has?

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.在 ARKit 中有一个ARSessionDelegate协议,它有 4 个主要方法,您可以实现从 AR 会话接收捕获的视频帧图像和跟踪状态。

Does ARCore API have a similar protocol (interface) with similar methods? ARCore API 是否有类似的协议(接口)和类似的方法?

override func viewDidLoad() {  
    super.viewDidLoad()
    sceneView.session.delegate = self       // ARSessionDelegate? protocol
}
  1. This method provides a newly captured ARCamera image and accompanying AR information to the delegate:此方法向委托提供新捕获的 ARCamera 图像和随附的 AR 信息:
func session(ARSession, didUpdate: ARFrame) { ... }
  1. This method tells the delegate that one or more ARAnchors have been added to the session:此方法告诉委托一个或多个 ARAnchor 已添加到会话中:
func session(ARSession, didAdd: [ARAnchor]) { ... }
  1. This method tells the delegate that the ARSession has adjusted the properties of one or more ARAnchors:这个方法告诉委托 ARSession 已经调整了一个或多个 ARAnchor 的属性:
func session(ARSession, didUpdate: [ARAnchor]) { ... }
  1. This method tells the delegate that one or more ARAnchors have been removed from the ARSession:此方法告诉委托一个或多个 ARAnchor 已从 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.如果 ARCore 中存在类似的方法(甚至不是全部),请向我展示它们使用 Kotlin 代码的样子。

Any help appreciated.任何帮助表示赞赏。

After going through an ARCore documentation I discovered at least two similar methods:在浏览了 ARCore 文档后,我发现了至少两种类似的方法:

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM