Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个平面射线相交的代码:http: //pastebin.com/2VuPeZ5r 我想我计算正确,但如果没有相交,我需要返回 null。我该如何检查?
谢谢
“没有交叉点”是什么意思?任何光线都会在某处与平面相交,除了光线完全垂直于平面法线的简并情况。要检测这种情况,请测试Vector3.Dot(Norm, ray.Dir) == 0.
Vector3.Dot(Norm, ray.Dir) == 0
如果您想知道交点是在射线原点之前还是之后,请测试t > 0.
t > 0