Struct collider::Hitbox [] [src]

pub struct Hitbox {
    pub shape: PlacedShape,
    pub vel: PlacedShape,
    pub end_time: f64,
}

Represents a moving shape for continuous collision testing.

Fields

The placed shape shape at the given point in time.

The width and height of the shape must be greater than padding (in the Collider constructor) at all times.

A velocity that describes how the shape is changing over time.

The vel may include the velocity of the width and height of the shape as well as the velocity of the position.

Since the width and height of the shape is greater than padding at all times, if a shape velocity is set that decreases the dimensions of the shape over time, then the user is responsible for ensuring that the shape will not decrease below this threshold. Collider will catch such mistakes in unoptimized builds.

An upper-bound on the time at which the hitbox will be updated by the user.

This is an advanced feature for efficiency and does not impact the results. Infinity is used as the default, but using a lower value may improve performance

Collider will panic if the end time is exceeded without update, at least in unoptimized builds. It is ultimately the user's responsibility to ensure that end times are not exceeded.

Methods

impl Hitbox
[src]

Constructs a new hitbox with the given shape and a vel of zero and duration of infinity.

Trait Implementations

impl PartialEq for Hitbox
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for Hitbox
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Hitbox
[src]

Formats the value using the given formatter.