This repository was archived by the owner on Mar 30, 2019. It is now read-only.
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
[Mathematics] BoundingFrustum.Intersects(...Ray...) not working correctly #730
Open
Description
I've stumbled upon a problem with the BoundingFrustum Ray intersection method.
In the case where the Ray.Position is not contained within the BoundingFrustum, the method does not work correctly in many cases:
The idea that is used (check whether middle position of min/max ray-plane-intersections is inside frustum) is not correct.
In many cases there are more than two ray-plane-intersections and the middle position is not meaningful.
Also some other notes about BoundingFrustum:
- In the first case where the Ray.Position is contained within the BoundingFrustum, shouldn't the inDistance be set to 0 and the outDistance to nearstPlaneDistance instead of inDistance to nearstPlaneDistance and outDistance to null.
- Perhaps the method bool Intersects(ref Ray ray), where we don't care about inDistance and outDistance, could use a different more efficient implementation.
- The method Contains(Vector3[] points) throws a NotImplementedException, perhaps it's better to remove the method instead.