在Swift 4.2中从SceneKit节点转换为数据时,为什么会收到“ inout simd_float3”(又名“ inout float3”)无法转换为“ float3”错误的信息?

时间:2018-10-19 11:44:28

标签: ios swift xcode opentok

我正在使用SceneKit和ARKit。在委托方法中将调用以下函数:

func prepare(videoFrame: OTVideoFrame) {
    let cameraNode = sceneView.scene.rootNode.childNodes.first {
        $0.camera != nil
    }
    if let node = cameraNode, let cam = node.camera {
        let data = Data(fromArray: [
            node.simdPosition.x,  
            node.simdPosition.y,
            node.simdPosition.z,
            node.eulerAngles.x,
            node.eulerAngles.y,
            node.eulerAngles.z,
            Float(cam.zNear),
            Float(cam.fieldOfView)
            ])

        var err: OTError?
        videoFrame.setMetadata(data, error: &err)
        if let e = err {
            print("Error adding frame metadata: \(e.localizedDescription)")
        }
    }
}

我在node.simdPosition.x行遇到以下错误:

'inout simd_float3' (aka 'inout float3') is not convertible to 'float3'

如何解决此错误?

0 个答案:

没有答案