- Home /
Help me understand the distance parameter in Plane constructor
I can't understand why there is a difference in using this two ways for constructing the plane.
var plane = new Plane(Vector3.Up, new Vector3(0f,0.2f, 0f);
and
var plane = new Plane(Vector3.Up, 0.2f);
I want to get a plane that is parallel to XZ plane and 0.2 higher (y=0.2f). The first constructor does this nice, but why is the second approach giving different results? I'm doing some raycasting to that plane and the second plane gets hit somewhere under XZ plane (y values are <0) The first constructor uses two parameters: normal vector and point through which the plane goes through. The second constructor uses also normal vector but the second parameter is float distance. What distance? Only thing I can think of is distance from the origin (0,0,0) and I think that would mean in the direction of the normal vector. Did I misunderstand this?
Yes, that seems to be the right, thank you. Still, it does not make sense to use the value in the opposite direction. Using negative value for distance does not sound right to me.
You might think about it like this: say you are at the origin, and you want to create a plane to look at. If you want the plane to face you, it has to be offset from you in the direction opposite its normal.
Answer by Victory Dan Greene · Jan 07, 2015 at 02:48 PM
It seems the plane is constructed using a point distance units from the origin, as you expected, but in the direction opposite the normal.
If you use...
var plane = new Plane(Vector3.Up, -0.2f);
...does it do what you want?