Struct pixel_game_lib::physics::rigidbody::RigidBodyQuery
source · pub struct RigidBodyQuery<'a> {
pub pos: &'a mut Position,
pub inertia: &'a Inertia,
pub inv_mass: &'a InvMass,
pub friction: &'a Friction,
pub rot: &'a mut Orientation,
pub restitution: &'a Restitution,
/* private fields */
}
Expand description
Simplified query for a rigidbody.
Everything that’s not optional here must also be part of the [BaseRigidBodyBundle
].
Fields§
§pos: &'a mut Position
§inertia: &'a Inertia
§inv_mass: &'a InvMass
§friction: &'a Friction
§rot: &'a mut Orientation
§restitution: &'a Restitution
Implementations§
source§impl<'a> RigidBodyQuery<'a>
impl<'a> RigidBodyQuery<'a>
sourcepub fn apply_positional_impulse(
&mut self,
positional_impulse: Vec2<f64>,
point: Vec2<f64>,
sign: f64
)
pub fn apply_positional_impulse( &mut self, positional_impulse: Vec2<f64>, point: Vec2<f64>, sign: f64 )
Apply a positional impulse at a point.
sourcepub fn apply_velocity_impulse(
&mut self,
velocity_impulse: Vec2<f64>,
point: Vec2<f64>,
sign: f64
)
pub fn apply_velocity_impulse( &mut self, velocity_impulse: Vec2<f64>, point: Vec2<f64>, sign: f64 )
Apply a velocity change at a point.
sourcepub fn rotate(&self, point: Vec2<f64>) -> Vec2<f64>
pub fn rotate(&self, point: Vec2<f64>) -> Vec2<f64>
Rotate a relative point to the position in that local space.
sourcepub fn delta_rotation_at_point(
&self,
point: Vec2<f64>,
impulse: Vec2<f64>
) -> f64
pub fn delta_rotation_at_point( &self, point: Vec2<f64>, impulse: Vec2<f64> ) -> f64
Calculate the update in rotation when a position change is applied at a specific point.
sourcepub fn relative_motion_at_point(&self, point: Vec2<f64>) -> Vec2<f64>
pub fn relative_motion_at_point(&self, point: Vec2<f64>) -> Vec2<f64>
Delta position of a point.
sourcepub fn inverse_mass_at_relative_point(
&self,
point: Vec2<f64>,
normal: Vec2<f64>
) -> f64
pub fn inverse_mass_at_relative_point( &self, point: Vec2<f64>, normal: Vec2<f64> ) -> f64
Calculate generalized inverse mass at a relative point along the normal vector.
sourcepub fn contact_velocity(&self, point: Vec2<f64>) -> Option<Vec2<f64>>
pub fn contact_velocity(&self, point: Vec2<f64>) -> Option<Vec2<f64>>
Calculate the contact velocity based on a local relative rotated point.
sourcepub fn prev_contact_velocity(&self, point: Vec2<f64>) -> Option<Vec2<f64>>
pub fn prev_contact_velocity(&self, point: Vec2<f64>) -> Option<Vec2<f64>>
Calculate the contact velocity based on a local relative rotated point.
sourcepub fn local_to_world(&self, point: Vec2<f64>) -> Vec2<f64>
pub fn local_to_world(&self, point: Vec2<f64>) -> Vec2<f64>
Calculate the world position of a relative point on this body without rotation in mind.
sourcepub fn combine_static_frictions(&self, other: &Self) -> f64
pub fn combine_static_frictions(&self, other: &Self) -> f64
Combine the static frictions between this and another body.
sourcepub fn combine_dynamic_frictions(&self, other: &Self) -> f64
pub fn combine_dynamic_frictions(&self, other: &Self) -> f64
Combine the dynamic frictions between this and another body.
sourcepub fn static_friction(&self) -> f64
pub fn static_friction(&self) -> f64
Friction that needs to be overcome before resting objects start sliding.
sourcepub fn dynamic_friction(&self) -> f64
pub fn dynamic_friction(&self) -> f64
Friction that’s applied to dynamic moving object after static friction has been overcome.
sourcepub fn combine_restitutions(&self, other: &Self) -> f64
pub fn combine_restitutions(&self, other: &Self) -> f64
Combine the restitutions between this and another body.
sourcepub fn translation(&self) -> Vec2<f64>
pub fn translation(&self) -> Vec2<f64>
The translation or zero if it’s static.
sourcepub fn previous_position(&self) -> Vec2<f64>
pub fn previous_position(&self) -> Vec2<f64>
The previous position or the current position if it’s static.
sourcepub fn previous_orientation(&self) -> Rotation
pub fn previous_orientation(&self) -> Rotation
The previous orientation or the current orientation if it’s static.
sourcepub fn is_kinematic(&self) -> bool
pub fn is_kinematic(&self) -> bool
Whether collisions should not affect the body.
Trait Implementations§
source§impl<'a> Debug for RigidBodyQuery<'a>
impl<'a> Debug for RigidBodyQuery<'a>
source§impl<'a> Query for RigidBodyQuery<'a>
impl<'a> Query for RigidBodyQuery<'a>
§type Item<'q> = RigidBodyQuery<'q>
type Item<'q> = RigidBodyQuery<'q>
Auto Trait Implementations§
impl<'a> Freeze for RigidBodyQuery<'a>
impl<'a> RefUnwindSafe for RigidBodyQuery<'a>
impl<'a> Send for RigidBodyQuery<'a>
impl<'a> Sync for RigidBodyQuery<'a>
impl<'a> Unpin for RigidBodyQuery<'a>
impl<'a> !UnwindSafe for RigidBodyQuery<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.