pub type RayIntersection = RayIntersection;Expand description
The intersection between a ray and a collider.
Aliased Type§
pub struct RayIntersection {
pub time_of_impact: f32,
pub normal: Vec3,
pub feature: FeatureId,
pub subshape: u32,
}Fields§
§time_of_impact: f32The time of impact (parameter t) where the ray hits the shape.
The exact hit point can be computed with ray.point_at(time_of_impact).
If the ray direction is normalized, this represents the distance traveled.
normal: Vec3The surface normal at the intersection point.
- Typically points outward from the shape
- May point inward if ray origin is inside a non-solid shape
- May be unreliable if
time_of_impactis exactly zero
Note: This should be a unit vector but is not enforced by the type system yet.
feature: FeatureIdThe geometric feature (vertex, edge, or face) that was hit.
This can be used for more detailed collision response or to identify exactly which part of the shape was struck.
subshape: u32