gpt4 book ai didi

c# - 检查屏幕上是否显示 Vector3

转载 作者:太空宇宙 更新时间:2023-11-03 21:43:06 26 4
gpt4 key购买 nike

我想知道是否有一种方法可以检查相机是否正在查看 3D 空间中的 Vector3 点,或者检查该点是否显示在屏幕上。

最佳答案

是的,只需将您的 View 和投影矩阵输入到这样的边界平截头体中即可:

//class scope variables
BoundingFrustum boundingFrustum;

//in the init method
boundingFrustum = new BoundingFrustum();

//In the Update method or wherever you need to run a check check
boundingFrustum.Matrix = view * projection;

bool isPointInView = boundingFrustum.Contains(Vector3ToTest);

关于c# - 检查屏幕上是否显示 Vector3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18381510/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com