您的位置:首页 > 移动开发 > Unity3D

Unity 3D 画出透视相机的视景体

2016-01-20 10:23 519 查看
void OnDrawGizmos()
{
Gizmos.color = Color.green;
if (theCamera == null)
theCamera = GetComponent<Camera>();
Gizmos.matrix = Matrix4x4.TRS(theCamera.transform.position, theCamera.transform.rotation, Vector3.one);
Gizmos.DrawFrustum(Vector3.zero, theCamera.fieldOfView, theCamera.farClipPlane, theCamera.nearClipPlane, theCamera.aspect);
}



以上代码为编辑器中画出透视相机的视景体,方便调试。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: