您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页ARKit类初印象

ARKit类初印象

来源:二三娱乐

ARSession

作用:管理增强现实体验所需的设备摄像头和运动处理的共享对象

ARSession主要做了以下几件事:

  • 从设备的运动传感硬件中读取数据
  • 控制设备的内置摄像头
  • 对捕获的摄像头图像执行图像分析
        /*
         Start the view's AR session with a configuration that uses the rear camera,
         device position and orientation tracking, and plane detection.
        */
        let configuration = ARWorldTrackingConfiguration()
        configuration.planeDetection = .horizontal
        sceneView.session.run(configuration)

        // Set a delegate to track the number of plane anchors for providing UI feedback.
        sceneView.session.delegate = self

ARConfiguration

用于AR session设置的抽象基类,它有三个子类:

  • 使用后置摄像头跟踪设备的位置和方向,并允许进行平面检测和击中测试
  • 使用后置摄像头,仅仅跟踪设备的方向
  • 提供使用前置摄像头的AR体验,并跟踪用户脸部的移动和表情

开发调试中几个有用的设置

改变颜色

plane.firstMaterial?.diffuse.contents = UIColor.red

显示统计

 sceneView.showsStatistics = true

显示坐标系
红黄蓝分别代表x、y、z轴,手机上默认是左手坐标系

 sceneView.debugOptions = ARSCNDebugOptions.showWorldOrigin

显示特征点

sceneView.debugOptions = ARSCNDebugOptions.showFeaturePoints

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务