Plane detection
平面检测是指检测和跟踪物理环境中的平面。通过 ARFoundation 中组件可以控制您应用中的平面检测功能,并为每个检测到的平面创建 ARPlane 追踪。
要求
需要 Play For Dream MR 设备, OS 3.1.0 以上版本
平面检测依赖 Scene 权限,需要前往
Edit > Project Settings
>XR Plug-in Management
>YVR
>Feature Request
,然后勾选Require Scene Anchor
来开启权限
使用说明
将
AR Plane Manager
组件添加到场景内 XROrigin 对象中。ARPlaneManager
组件是平面追踪管理器,用于检测和追踪物理环境中的平面。为每个检测到的平面在您的场景中创建 GameObject为
AR Plane Manager
添加Plane Prefab
预制体,当检测到追踪平面时,管理器会创建Plane Prefab
GameObject,Plane Prefab
中会包含平面相关数据,并持续更新平面Plane Prefab
预制体上需添加AR Plane
与AR Plane Mesh Visualizer
组件来追踪与更新平面,根据AR Plane Mesh Visualizer
脚本功能为对象添加Mesh Filter
/Mesh Render
/Line Render
可以展示平面显示效果
平面检测组件详细文档可通过 AR Foundation Plane detection 查看