WriteRigidBodyForces

Trait WriteRigidBodyForces 

Source
pub trait WriteRigidBodyForces: ReadRigidBodyForces + WriteRigidBodyForcesInternal {
Show 19 methods // Provided methods fn apply_force(&mut self, force: Vector) { ... } fn apply_force_at_point(&mut self, force: Vector, world_point: Vector) { ... } fn apply_local_force(&mut self, force: Vector) { ... } fn apply_torque(&mut self, torque: Vector) { ... } fn apply_local_torque(&mut self, torque: Vector) { ... } fn apply_linear_impulse(&mut self, impulse: Vector) { ... } fn apply_linear_impulse_at_point( &mut self, impulse: Vector, world_point: Vector, ) { ... } fn apply_local_linear_impulse(&mut self, impulse: Vector) { ... } fn apply_angular_impulse(&mut self, impulse: Vector) { ... } fn apply_local_angular_impulse(&mut self, impulse: Vector) { ... } fn apply_linear_acceleration(&mut self, acceleration: Vector) { ... } fn apply_linear_acceleration_at_point( &mut self, acceleration: Vector, world_point: Vector, ) { ... } fn apply_local_linear_acceleration(&mut self, acceleration: Vector) { ... } fn apply_angular_acceleration(&mut self, acceleration: Vector) { ... } fn apply_local_angular_acceleration(&mut self, acceleration: Vector) { ... } fn linear_velocity_mut(&mut self) -> &mut Vector { ... } fn angular_velocity_mut(&mut self) -> &mut Vector { ... } fn reset_accumulated_linear_acceleration(&mut self) { ... } fn reset_accumulated_angular_acceleration(&mut self) { ... }
}
Expand description

A trait for applying forces, impulses, and accelerations to a dynamic rigid body.

This is implemented as a shared interface for the ForcesItem and NonWakingForcesItem returned by Forces.

See the documentation of Forces for more information on how to apply forces in Avian.

Provided Methods§

Source

fn apply_force(&mut self, force: Vector)

Applies a force at the center of mass in world space. The unit is typically N or kg⋅m/s².

The force is applied continuously over the physics step and cleared afterwards.

By default, a non-zero force will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_force_at_point(&mut self, force: Vector, world_point: Vector)

Applies a force at the given point in world space. The unit is typically N or kg⋅m/s².

If the point is not at the center of mass, the force will also generate a torque.

The force is applied continuously over the physics step and cleared afterwards.

By default, a non-zero force will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

§Note

If the Transform of the body is modified before applying the force, the torque will be computed using an outdated global center of mass. This may cause problems when applying a force right after teleporting an entity, as the torque could grow very large if the distance between the point and old center of mass is large.

In case this is causing problems, consider using the PhysicsTransformHelper to update the global physics transform after modifying Transform.

Source

fn apply_local_force(&mut self, force: Vector)

Applies a force at the center of mass in local space. The unit is typically N or kg⋅m/s².

The force is applied continuously over the physics step and cleared afterwards.

By default, a non-zero force will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_torque(&mut self, torque: Vector)

Applies a torque in world space. The unit is typically N⋅m or kg⋅m²/s².

The torque is applied continuously over the physics step and cleared afterwards.

By default, a non-zero torque will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_local_torque(&mut self, torque: Vector)

Applies a torque in local space. The unit is typically N⋅m or kg⋅m²/s².

The torque is applied continuously over the physics step and cleared afterwards.

By default, a non-zero torque will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_linear_impulse(&mut self, impulse: Vector)

Applies a linear impulse at the center of mass in world space. The unit is typically N⋅s or kg⋅m/s.

The impulse modifies the LinearVelocity of the body immediately.

By default, a non-zero impulse will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_linear_impulse_at_point( &mut self, impulse: Vector, world_point: Vector, )

Applies a linear impulse at the given point in world space. The unit is typically N⋅s or kg⋅m/s.

If the point is not at the center of mass, the impulse will also generate an angular impulse.

The impulse modifies the LinearVelocity and AngularVelocity of the body immediately.

By default, a non-zero impulse will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

§Note

If the Transform of the body is modified before applying the impulse, the torque will be computed using an outdated global center of mass. This may cause problems when applying a impulse right after teleporting an entity, as the torque could grow very large if the distance between the point and old center of mass is large.

In case this is causing problems, consider using the PhysicsTransformHelper to update the global physics transform after modifying Transform.

Source

fn apply_local_linear_impulse(&mut self, impulse: Vector)

Applies a linear impulse in local space. The unit is typically N⋅s or kg⋅m/s.

The impulse modifies the LinearVelocity of the body immediately.

By default, a non-zero impulse will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_angular_impulse(&mut self, impulse: Vector)

Applies an angular impulse in world space. The unit is typically N⋅m⋅s or kg⋅m²/s.

The impulse modifies the AngularVelocity of the body immediately.

By default, a non-zero impulse will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_local_angular_impulse(&mut self, impulse: Vector)

Applies an angular impulse in local space. The unit is typically N⋅m⋅s or kg⋅m²/s.

The impulse modifies the AngularVelocity of the body immediately.

By default, a non-zero impulse will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_linear_acceleration(&mut self, acceleration: Vector)

Applies a linear acceleration, ignoring mass. The unit is typically m/s².

The acceleration is applied continuously over the physics step and cleared afterwards.

By default, a non-zero acceleration will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_linear_acceleration_at_point( &mut self, acceleration: Vector, world_point: Vector, )

Applies a linear acceleration at the given point in world space. The unit is typically m/s².

If the point is not at the center of mass, the acceleration will also generate an angular acceleration.

The acceleration is applied continuously over the physics step and cleared afterwards.

By default, a non-zero acceleration will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

§Note

If the Transform of the body is modified before applying the acceleration, the angular acceleration will be computed using an outdated global center of mass. This may cause problems when applying a acceleration right after teleporting an entity, as the angular acceleration could grow very large if the distance between the point and old center of mass is large.

In case this is causing problems, consider using the PhysicsTransformHelper to update the global physics transform after modifying Transform.

Source

fn apply_local_linear_acceleration(&mut self, acceleration: Vector)

Applies a linear acceleration in local space, ignoring mass. The unit is typically m/s².

The acceleration is applied continuously over the physics step and cleared afterwards.

By default, a non-zero acceleration will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_angular_acceleration(&mut self, acceleration: Vector)

Applies an angular acceleration, ignoring angular inertia. The unit is rad/s².

The acceleration is applied continuously over the physics step and cleared afterwards.

By default, a non-zero acceleration will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn apply_local_angular_acceleration(&mut self, acceleration: Vector)

Applies an angular acceleration in local space, ignoring angular inertia. The unit is rad/s².

The acceleration is applied continuously over the physics step and cleared afterwards.

By default, a non-zero acceleration will wake up the body if it is sleeping. This can be prevented by first calling ForcesItem::non_waking to get a NonWakingForcesItem.

Source

fn linear_velocity_mut(&mut self) -> &mut Vector

Returns a mutable reference to the LinearVelocity of the body in world space.

Source

fn angular_velocity_mut(&mut self) -> &mut Vector

Returns a mutable reference to the AngularVelocity of the body in world space.

Source

fn reset_accumulated_linear_acceleration(&mut self)

Resets the accumulated linear acceleration to zero.

Source

fn reset_accumulated_angular_acceleration(&mut self)

Resets the accumulated angular acceleration to zero.

Implementors§