我收到了一个关于init()不能用于ARLightEstimate的错误。
代码:
class LightSensorManager {
let lightEstimate = ARLightEstimate() // <-- error is here
var ambientLightIntensity: CGFloat
init() {
ambientLightIntensity = lightEstimate.ambientIntensity
}
}错误:
/* 'init()' is unavailable */API to ARLightEstimation - ARKit
我想这是个抽象类吧?但我找不到它的具体子类。我只想使用来自这个API的环境光传感器来检测周围的光。
发布于 2020-01-15 18:39:44
下面是如何在
Light Estimation中使用ARKit - 完整代码版本在这里:
renderer(_:updateAtTime:) SceneKit的实例方法中更新照明:
函数渲染器(_ renderer: SCNSceneRenderer,updateAtTime time: TimeInterval) {updateAtTime lightEstimate = sceneView.session.currentFrame?.lightEstimate lightEstimate=sceneView.session.currentFrame?.lightEstimate lightEstimate} spotLightNode.light?.intensity = lightEstimate.ambientIntensity }https://stackoverflow.com/questions/59756284
复制相似问题