当我更改相机的投影转换时,SCNView hittest 什么都不返回

问题描述

更改camera.projectonTransfrom 后,hitTest 返回空。

我更改了 projectonTransfrom 来自

SCNMatrix4(m11: 1.7320508,m12: 0.0,m13: 0.0,m14: 0.0,m21: 0.0,m22: 1.7320508,m23: 0.0,m24: 0.0,m31: 0.0,m32: 0.0,m33: -1.020202,m34: -1.0,m41: 0.0,m42: 0.0,m43: -2.020202,m44: 0.0)

SCNMatrix4(m11: 1.4807686,m22: -3.2045352,m31: -0.0075915335,m32: -0.023523442,m33: 1.0000119,m34: 1.0,m43: -0.060000356,m44: 0.0)

在我更改转换之前它工作正常。

override func touchesEnded(_ touches: Set<UITouch>,with event: UIEvent?) {
    let touch = touches.first!
    location = touch.location(in: sceneView)
    let options: [SCNHitTestOption : Any] = [SCNHitTestOption.searchMode: 1]
    var hitResults = sceneView.hitTest(location,options: options)
    print(hitResults.count) // It is always 0. After I changed the transform.
}
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)