pub struct RigidBody {Show 17 fields
pub position: Vec2,
pub position_old: Vec2,
pub center_of_mass: Vec2,
pub calculated_mass: f32,
pub gravity_mod: f32,
pub rotation: f32,
pub angular_velocity: f32,
pub torque: f32,
pub inertia: f32,
pub scale: Vec2,
pub acceleration: Vec2,
pub velocity_request: Option<Vec2>,
pub calculated_velocity: Vec2,
pub colliders: Vec<ColliderHandle>,
pub connected_joints: Vec<JointHandle>,
pub user_data: u128,
pub body_type: RigidBodyType,
}
Fields§
§position: Vec2
§position_old: Vec2
§center_of_mass: Vec2
Represented as offset from position
calculated_mass: f32
§gravity_mod: f32
§rotation: f32
§angular_velocity: f32
§torque: f32
§inertia: f32
§scale: Vec2
§acceleration: Vec2
§velocity_request: Option<Vec2>
§calculated_velocity: Vec2
§colliders: Vec<ColliderHandle>
§connected_joints: Vec<JointHandle>
§user_data: u128
§body_type: RigidBodyType
Implementations§
source§impl RigidBody
impl RigidBody
pub fn data(&self) -> RigidBodyData
pub fn transform(&self) -> Affine2
pub fn translation(&self) -> Vec2
pub fn update_mass_and_inertia(&mut self, col_set: &ColliderSet)
pub fn apply_impulse(&mut self, impulse: Vec2)
pub fn apply_impulse_at_point(&mut self, impulse: Vec2, world_point: Vec2)
pub fn add_velocity(&mut self, velocity: Vec2)
pub fn apply_force(&mut self, force: Vec2)
pub fn apply_force_at_point(&mut self, force: Vec2, world_point: Vec2)
sourcepub fn apply_torque_at_point(&mut self, force: Vec2, world_point: Vec2)
pub fn apply_torque_at_point(&mut self, force: Vec2, world_point: Vec2)
Unlike apply_force_at_point this only applies torque.
pub fn set_velocity(&mut self, velocity: Vec2)
pub fn get_velocity(&self) -> Vec2
pub fn colliders(&self) -> impl Iterator<Item = &ColliderHandle>
pub fn body_type(&self) -> RigidBodyType
pub fn is_dynamic(&self) -> bool
pub fn is_kinematic(&self) -> bool
pub fn accelerate(&mut self, a: Vec2)
pub fn is_static(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for RigidBody
impl Send for RigidBody
impl Sync for RigidBody
impl Unpin for RigidBody
impl UnwindSafe for RigidBody
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
Mutably borrows from an owned value. Read more