Line vs Plane

From Fancade Wiki
Line vs Plane
Line vs Plane.png
TypeScript block
ColliderNone
FolderMath
Ports
Inputs Line From
Line To
Plane Point
Plane Normal
Outputs Intersection

Finds the point at which a line intersects a plane.

Notes

  • It's a line, not a line segment, so the intersection will be found even if it's not in-between the line's from/to positions.
  • Plane Point is a position on the plane.
Plane Normal is a vector perpendicular to the plane (i.e. the direction the plane is pointing at, or the angle of the plane).
  • The output is NaN if the line does not intersect the plane.
This happens if the line is parallel to the plane or plane normal is (0,0,0)

Example

A common use case for Line vs Plane is to find the world coordinate of the user's finger:

Place a block on the floor where the player touches

The finger touches a 2D screen, but there's a whole bunch 3D points along a line into the scene, which are all at that 2D coordinate. So the above script first uses Screen To World to get two points on that line, and then Line vs Plane to pick out the one position that lies on the floor plane (point 0,0,0 and normal 0,1,0). As a result, the Wood block will move to the finger!