normal and direction are normalized (but it is not enforced in the doc / code - maybe the plane normal property is stored normalized?)
epsilon is a number just bigger than -1, that is something like -0.99 (but it should be explained in the doc)
I think isFrontFacingTo aim is to detect if the plane normal and the direction are opposite vectors (so we can say that “the plane is facing the given direction”), so if their angle is ~180°, meaning cos(angle) = dot = -1.
Yes, I think something like dot <= -1 + epsilon would be better, as epsilon would need to be a small value just above 0, as everyone expects from a well-behaved epsilon.
yeah but the function name is FrontFacingTo, so I would expect that two vectors pointing the same direction will return true, right?
In this case the dot will be 1, correct?
If a plane is front facing a direction, for me it means its normal is directly opposite to the direction we want to check.
Say the plane is perpendicular to our view direction, so lies in x/y and its normal is (0,0,-1) (if the normal were (0,0,1) it would be a back face and not visible). The view direction is (0,0,1), so the dot product is -1. In this configuration, I would say the plane is front facing the view direction.
Checks if the plane’s normal is pointing in the opposite direction of the given vector.
To make things clearer, I have added both to the doc:
I didn’t perform the change dot <= -1 + epsilon to avoid a breaking change (but I have explained which value epsilon should have with the current code to make things work).