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, usually Vector2 or Vector3
  • T: Torque force, usually Scalar or Vector3

Implementations

Create a new force accumulator

Add a force vector to the accumulator

Add a torque vector to the accumulator

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 apply
  • position: 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

Consume the accumulated force

Returns he current accumulated force. The force in the accumulator is reset.

Consume the torque

Returns the current accumulated torque. The torque in the accumulator is reset.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.