I ran into some issues with one of the constructors for planes in unity 5.3.2. It’s easy to reproduce:
Vector3 target = new Vector3(2.6f, 4f, 3.5f);
Vector3 cameraPosition = new Vector3(10.5f, 14.3f, 12.4f);
Vector3 normal = target - cameraPosition;
float planarDistance = Vector3.Project(target, normal).magnitude;
Plane normalPlane = new Plane(normal, planarDistance);
Plane insanePlane = new Plane(normal, target);
Debug.Log("Correct planar distance: " + normalPlane.distance + ", Other, inexplicable distance: " + insanePlane.distance);
Which prints:
Correct planar distance: 5.901973, Other, inexplicable distance: 92.89
Am I misunderstanding how that constructor is supposed to work? How could the plane distance possibly be 93? That’s significantly larger than all of the input numbers.
If I understand correctly, the 2 vector constructor should do exactly what I did with the projection.