Struct rhusics::physics::ForceAccumulator
[−]
[src]
pub struct ForceAccumulator<F, T> { /* fields omitted */ }
Force accumulator for a rigid body.
Will be consumed when doing force integration for the next frame.
Type parameters:
F
: Force type, usuallyVector2
orVector3
T
: Torque force, usuallyScalar
orVector3
Methods
impl<F, T> ForceAccumulator<F, T> where
F: VectorSpace + Zero,
T: Zero + Copy + Clone,
[src]
F: VectorSpace + Zero,
T: Zero + Copy + Clone,
fn new() -> Self
[src]
Create a new force accumulator
fn add_force(&mut self, force: F)
[src]
Add a force vector to the accumulator
fn add_torque(&mut self, torque: T)
[src]
Add a torque vector to the accumulator
fn add_force_at_point<P, R>(
&mut self,
force: F,
position: P,
pose: &BodyPose<P, R>
) where
P: EuclideanSpace<Scalar = F::Scalar, Diff = F>,
P::Scalar: BaseFloat,
R: Rotation<P>,
F: PartialCrossProduct<F, Output = T>,
[src]
&mut self,
force: F,
position: P,
pose: &BodyPose<P, R>
) where
P: EuclideanSpace<Scalar = F::Scalar, Diff = F>,
P::Scalar: BaseFloat,
R: Rotation<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
fn consume_force(&mut self) -> F
[src]
Consume the accumulated force
Returns he current accumulated force. The force in the accumulator is reset.
fn consume_torque(&mut self) -> T
[src]
Consume the torque
Returns the current accumulated torque. The torque in the accumulator is reset.