public static Vector4[] GetProjectionCorners(RectTransform rectTransform, Camera uiCamera) { var worldCorners = new Vector3[4]; // lt lb rb rt rectTransform.GetWorldCorners(worldCorners); var matrixMVP = uiCamera.projectionMatrix * uiCamera.worldToCameraMatrix; //左乘 Vector4[] projectionCorners = new Vector4[4]; for (int i = 0; i < 4; ++i) { Vector4 wsCorner = worldCorners[i]; wsCorner.w = 1; projectionCorners[i] = matrixMVP * wsCorner; //左乘mvp矩阵 } return projectionCorners; //裁剪空间下 }
标签:worldCorners,corners,projectionCorners,裁剪,Vector4,uiCamera,计算,wsCorner From: https://www.cnblogs.com/sailJs/p/17071008.html