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

来源:互联网 发布:不愿意交际 知乎 编辑:程序博客网 时间:2024/06/11 04:52
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);}


以上代码为编辑器中画出透视相机的视景体,方便调试。

0 0
原创粉丝点击