After I changed the camera.projectonTransfrom, hitTest returns empty.
I changed the projectonTransfrom from
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)
to
SCNMatrix4(m11: 1.4807686, m12: 0.0, m13: 0.0, m14: 0.0,
m21: 0.0, m22: -3.2045352, m23: 0.0, m24: 0.0,
m31: -0.0075915335, m32: -0.023523442, m33: 1.0000119, m34: 1.0,
m41: 0.0, m42: 0.0, m43: -0.060000356, m44: 0.0)
It worked properly before I changed the transform.
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.
}
question from:
https://stackoverflow.com/questions/65879404/scnview-hittest-return-nothing-when-i-change-projectiontransform-of-camera 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…