// 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");
}

相关文章:

  • 2022-01-19
  • 2021-09-03
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
猜你喜欢
  • 2021-10-08
  • 2021-12-08
  • 2021-04-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
相关资源
相似解决方案