Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
734 views
in Technique[技术] by (71.8m points)

matrix - SCNView hittest return nothing when I change projectionTransform of camera

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...