// Detects manually if anObject is being seen by the main camera
var anObject : GameObject;
private var cam : Camera;
private var planes : Plane[];
function Start() {
cam = Camera.main;
planes = GeometryUtility.CalculateFrustumPlanes(cam);
}
function Update() {
if(GeometryUtility.TestPlanesAABB(planes,anObject.collider.bounds))
Debug.Log(anObject.name + " has been detected!");
else
Debug.Log("Nothing has been detected");
}
检测是否渲染
最新推荐文章于 2023-06-20 16:58:15 发布