Closed shanehyde closed 3 years ago
At further looking, seems that BoundingFrustum is not really adaptable to ortho, since it doesnt store the plane offsets. Perhaps the documentation should be updated to reflect that it doesnt function with ortho at all.
A Frustum is almost always associated with a perspective projection AFAIK for collision volumes. Wouldn't an orthographic projection just be a bounding box or oriented bounding box?
When creating a BoundingFrustum from an orthographic projection, the following values are created for the slopes
RightSlope = -0.5 LeftSlope = 0.5 TopSlope = -0.5 BottomSlope = 0.5
The correct values for the slopes for an orthographic projection should all be 0. There is no slope to the planes in an ortho projection.
The error is caused by the assumption that the x/y values will vary from 0 to the provided value over the z range. But, in ortho x/y will not vary over the z range.
If you create a Frustum like this, all collision tests will be wrong, since the wrong planes will be used for testing.
This could be fixed by using all 8 points of the frustum instead of just 4.