Skip to main content

ray_plane_intersection

Function ray_plane_intersection 

Source
pub fn ray_plane_intersection(
    ray_origin: Vec3,
    ray_dir: Vec3,
    plane_normal: Vec3,
    plane_distance: f32,
) -> Option<Vec3>
Expand description

Compute the intersection point of a ray with a plane.

The plane equation is dot(p, normal) + distance = 0, matching ClipShape::Plane.

Returns Some(point) if the ray hits the plane in front of the origin, None if the ray is parallel to the plane or the intersection is behind it.