Type Alias rapier3d::geometry::RayIntersection

source ·
pub type RayIntersection = RayIntersection;
Expand description

The intersection between a ray and a collider.

Aliased Type§

struct RayIntersection {
    pub time_of_impact: f32,
    pub normal: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
    pub feature: FeatureId,
}

Fields§

§time_of_impact: f32

The time of impact of the ray with the object. The exact contact point can be computed with: ray.point_at(time_of_impact) or equivalently origin + dir * time_of_impact where origin is the origin of the ray; dir is its direction and time_of_impact is the value of this field.

§normal: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>

The normal at the intersection point.

If the origin of the ray is inside the shape and the shape is not solid, the normal will point towards the interior of the shape. Otherwise, the normal points outward.

If the time_of_impact is exactly zero, the normal might not be reliable.

§feature: FeatureId

Feature at the intersection point.