Skip to main content

ShapeCastHit

Type Alias ShapeCastHit 

Source
pub type ShapeCastHit = ShapeCastHit;
Expand description

The result of a shape-cast between two shapes.

Aliased Type§

pub struct ShapeCastHit {
    pub time_of_impact: f32,
    pub witness1: Vec2,
    pub witness2: Vec2,
    pub normal1: Vec2,
    pub normal2: Vec2,
    pub status: ShapeCastStatus,
}

Fields§

§time_of_impact: f32

The time at which the objects touch.

§witness1: Vec2

The closest point on the first shape at the time of impact, expressed in the frame of the query (see the frame conventions).

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

§witness2: Vec2

The closest point on the second shape at the time of impact, expressed in the frame of the query (see the frame conventions).

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: Vec2

The outward normal on the first shape at the time of impact, expressed in the frame of the query (see the frame conventions).

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: Vec2

The outward normal on the second shape at the time of impact, expressed in the frame of the query (see the frame conventions).

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.