ARPlaneAnchor 的范围属性已弃用

问题描述 投票:0回答:1

我正在使用 ARKit 通过 SceneKit 构建 AR 应用程序。当我创建 SCNPlane 对象时,当 SceneKit 使用 ARPlaneAnchor 的

extent
of
x
y
属性检测到水平面时,我遇到了这个警告:

// *'extent' was deprecated in iOS 16*

我该如何解决这个问题?

我的示例代码如下:

let planeAnchor = anchor as! ARPlaneAnchor```

let plane = SCNPlane(width: CGFloat(planeAnchor.extent.x), 
                    height: CGFloat(planeAnchor.extent.z))
swift scenekit arkit aranchor
1个回答
0
投票

使用

planeExtent
实例属性代替。

@available(iOS 16.0, *)
open var planeExtent: ARPlaneExtent { get }

在 iOS 16.0 及更高版本中,

extend
属性已弃用:

@available(iOS, introduced: 11.0, deprecated: 16.0)
open var extent: simd_float3 { get }
© www.soinside.com 2019 - 2024. All rights reserved.