Type Alias rapier2d::geometry::ShapeCastHit

source ·
pub type ShapeCastHit = ShapeCastHit;
Expand description

The result of a shape-cast between two shapes.

Aliased Type§

struct ShapeCastHit {
    pub time_of_impact: f32,
    pub witness1: OPoint<f32, Const<2>>,
    pub witness2: OPoint<f32, Const<2>>,
    pub normal1: Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>,
    pub normal2: Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>,
    pub status: ShapeCastStatus,
}

Fields§

§time_of_impact: f32

The time at which the objects touch.

§witness1: OPoint<f32, Const<2>>

The local-space closest point on the first shape at the time of impact.

This value is unreliable if status is [ShapeCastStatus::PenetratingOrWithinTargetDist] and [ShapeCastOptions::compute_impact_geometry_on_penetration] was set to false.

§witness2: OPoint<f32, Const<2>>

The local-space closest point on the second shape at the time of impact.

This value is unreliable if status is [ShapeCastStatus::PenetratingOrWithinTargetDist] and both [ShapeCastOptions::compute_impact_geometry_on_penetration] was set to false when calling the time-of-impact function.

§normal1: Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>

The local-space outward normal on the first shape at the time of impact.

This value is unreliable if status is [ShapeCastStatus::PenetratingOrWithinTargetDist] and both [ShapeCastOptions::compute_impact_geometry_on_penetration] was set to false when calling the time-of-impact function.

§normal2: Unit<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>>

The local-space outward normal on the second shape at the time of impact.

This value is unreliable if status is [ShapeCastStatus::PenetratingOrWithinTargetDist] and both [ShapeCastOptions::compute_impact_geometry_on_penetration] was set to false when calling the time-of-impact function.

§status: ShapeCastStatus

The way the shape-casting algorithm terminated.