Struct rhusics_core::ForceAccumulator
source · pub struct ForceAccumulator<F, T> { /* private fields */ }
Expand description
Force accumulator for a physical entity.
Will be consumed when doing force integration for the next frame.
Type parameters:
F
: Force type, usuallyVector2
orVector3
T
: Torque force, usuallyScalar
orVector3
Implementations
sourceimpl<F, T> ForceAccumulator<F, T>where
F: VectorSpace + Zero,
T: Zero + Copy + Clone,
impl<F, T> ForceAccumulator<F, T>where
F: VectorSpace + Zero,
T: Zero + Copy + Clone,
sourcepub fn add_torque(&mut self, torque: T)
pub fn add_torque(&mut self, torque: T)
Add a torque vector to the accumulator
sourcepub fn add_force_at_point<P, B>(&mut self, force: F, position: P, pose: &B)where
P: EuclideanSpace<Scalar = F::Scalar, Diff = F>,
P::Scalar: BaseFloat,
B: Transform<P>,
F: PartialCrossProduct<F, Output = T>,
pub fn add_force_at_point<P, B>(&mut self, force: F, position: P, pose: &B)where
P: EuclideanSpace<Scalar = F::Scalar, Diff = F>,
P::Scalar: BaseFloat,
B: Transform<P>,
F: PartialCrossProduct<F, Output = T>,
Add a force on a given point on the body
If the force vector does not pass directly through the origin of the body, as expressed by the pose, torque will occur. Note that no validation is made on the given position to make sure it’s actually contained in the shape of the body.
Parameters:
force
: Force to applyposition
: Position on the body to apply the force at.pose
: Current pose of the body, used to compute the world coordinates of the body center of mass
sourcepub fn consume_force(&mut self) -> F
pub fn consume_force(&mut self) -> F
Consume the accumulated force
Returns he current accumulated force. The force in the accumulator is reset.
sourcepub fn consume_torque(&mut self) -> T
pub fn consume_torque(&mut self) -> T
Consume the torque
Returns the current accumulated torque. The torque in the accumulator is reset.
Trait Implementations
sourceimpl<F: Debug, T: Debug> Debug for ForceAccumulator<F, T>
impl<F: Debug, T: Debug> Debug for ForceAccumulator<F, T>
Auto Trait Implementations
impl<F, T> RefUnwindSafe for ForceAccumulator<F, T>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<F, T> Send for ForceAccumulator<F, T>where
F: Send,
T: Send,
impl<F, T> Sync for ForceAccumulator<F, T>where
F: Sync,
T: Sync,
impl<F, T> Unpin for ForceAccumulator<F, T>where
F: Unpin,
T: Unpin,
impl<F, T> UnwindSafe for ForceAccumulator<F, T>where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more