码迷,mamicode.com
首页 > 其他好文 > 详细

查看物体A是否被相机B渲染

时间:2014-05-05 22:00:12      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   tar   

bubuko.com,布布扣
using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    public GameObject anObject ;
    private Camera cam ;
    private Plane[] planes ;
    
    void Start() {
        cam = Camera.main;
        planes = GeometryUtility.CalculateFrustumPlanes(cam);
    }
    
    void Update() {
        if(GeometryUtility.TestPlanesAABB(planes,anObject.collider.bounds))
            Debug.Log(anObject.name + " has been detected!");
        else
            Debug.Log("Nothing has been detected");
    }
}
bubuko.com,布布扣

 官网地址:http://docs.unity3d.com/Documentation/ScriptReference/GeometryUtility.TestPlanesAABB.html

查看物体A是否被相机B渲染,布布扣,bubuko.com

查看物体A是否被相机B渲染

标签:style   blog   class   code   java   tar   

原文地址:http://www.cnblogs.com/123ing/p/3704898.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!