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
shape: PlacedShape
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.
vel: PlacedShape
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.
end_time: f64
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]
fn new(shape: PlacedShape) -> Hitbox
Constructs a new hitbox with the given shape
and a vel
of zero and duration
of infinity.
Trait Implementations
impl PartialEq for Hitbox
[src]
fn eq(&self, __arg_0: &Hitbox) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Hitbox) -> bool
This method tests for !=
.
impl Clone for Hitbox
[src]
fn clone(&self) -> Hitbox
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more