Whether a 3D picking ray intersects with a plane. The plane is defined as having a
normal [x, y, z] and
var intersect =var origin = 1 0 4var dir = 0 0 -1var normal = 0 0 1var distance = 0var hit =if hit //collision occurredconsole // [1, 0, 0]
The distance can be determined with a second point on the plane, like so:
var d = -
hit = intersect(out, origin, direction, normal, distance)
Test whether the ray
(origin, direction) intersects with the plane
If an intersection occurs, it is stored in
out [x, y, z] and returned. Otherwise
null is returned.
MIT, see LICENSE.md for details.