private void DrawDebugVisualization() { if (this.visualizeInScene) { ClipPlaneCornerPoints nearClipPlaneCornerPoints = this.GetNearClipPlaneCornerPoints(this.transform.position); Debug.DrawLine(this.pivot.position, this.transform.position - this.transform.forward * this.myCamera.nearClipPlane, Color.red); Debug.DrawLine(this.pivot.position, nearClipPlaneCornerPoints.UpperLeft, Color.green); Debug.DrawLine(this.pivot.position, nearClipPlaneCornerPoints.UpperRight, Color.green); Debug.DrawLine(this.pivot.position, nearClipPlaneCornerPoints.LowerLeft, Color.green); Debug.DrawLine(this.pivot.position, nearClipPlaneCornerPoints.LowerRight, Color.green); Debug.DrawLine(nearClipPlaneCornerPoints.UpperLeft, nearClipPlaneCornerPoints.UpperRight, Color.green); Debug.DrawLine(nearClipPlaneCornerPoints.UpperRight, nearClipPlaneCornerPoints.LowerRight, Color.green); Debug.DrawLine(nearClipPlaneCornerPoints.LowerRight, nearClipPlaneCornerPoints.LowerLeft, Color.green); Debug.DrawLine(nearClipPlaneCornerPoints.LowerLeft, nearClipPlaneCornerPoints.UpperLeft, Color.green); } }
private ClipPlaneCornerPoints GetNearClipPlaneCornerPoints(Vector3 cameraPosition) { ClipPlaneCornerPoints nearClipPlanePoints = new ClipPlaneCornerPoints(); nearClipPlanePoints.UpperLeft = cameraPosition - this.transform.right * nearClipPlaneHalfWidth; nearClipPlanePoints.UpperLeft += this.transform.up * nearClipPlaneHalfHeight; nearClipPlanePoints.UpperLeft += this.transform.forward * this.myCamera.nearClipPlane; nearClipPlanePoints.UpperRight = cameraPosition + this.transform.right * nearClipPlaneHalfWidth; nearClipPlanePoints.UpperRight += this.transform.up * nearClipPlaneHalfHeight; nearClipPlanePoints.UpperRight += this.transform.forward * this.myCamera.nearClipPlane; nearClipPlanePoints.LowerLeft = cameraPosition - this.transform.right * nearClipPlaneHalfWidth; nearClipPlanePoints.LowerLeft -= this.transform.up * nearClipPlaneHalfHeight; nearClipPlanePoints.LowerLeft += this.transform.forward * this.myCamera.nearClipPlane; nearClipPlanePoints.LowerRight = cameraPosition + this.transform.right * nearClipPlaneHalfWidth; nearClipPlanePoints.LowerRight -= this.transform.up * nearClipPlaneHalfHeight; nearClipPlanePoints.LowerRight += this.transform.forward * this.myCamera.nearClipPlane; return(nearClipPlanePoints); }