pub struct RigidBody2D {Show 25 fields
pub id: BodyId,
pub body_type: BodyType,
pub shape: Shape,
pub material: PhysicsMaterial,
pub position: Vec2,
pub angle: f32,
pub linear_velocity: Vec2,
pub angular_velocity: f32,
pub mass: f32,
pub inv_mass: f32,
pub inertia: f32,
pub inv_inertia: f32,
pub force: Vec2,
pub torque: f32,
pub linear_damping: f32,
pub angular_damping: f32,
pub sleeping: bool,
pub user_data: u64,
pub collision_layer: u32,
pub collision_mask: u32,
pub prev_position: Vec2,
pub prev_angle: f32,
pub enabled: bool,
pub fixed_rotation: bool,
pub gravity_scale: f32,
/* private fields */
}Fields§
§id: BodyId§body_type: BodyType§shape: Shape§material: PhysicsMaterial§position: Vec2§angle: f32§linear_velocity: Vec2§angular_velocity: f32§mass: f32§inv_mass: f32§inertia: f32§inv_inertia: f32§force: Vec2§torque: f32§linear_damping: f32§angular_damping: f32§sleeping: bool§user_data: u64§collision_layer: u32§collision_mask: u32§prev_position: Vec2§prev_angle: f32§enabled: bool§fixed_rotation: bool§gravity_scale: f32Implementations§
Source§impl RigidBody2D
impl RigidBody2D
pub fn new(id: BodyId, shape: Shape, material: PhysicsMaterial) -> Self
pub fn static_body(id: BodyId, shape: Shape) -> Self
pub fn apply_force(&mut self, force: Vec2)
pub fn apply_force_at(&mut self, force: Vec2, point: Vec2)
pub fn apply_impulse(&mut self, impulse: Vec2)
pub fn apply_impulse_at(&mut self, impulse: Vec2, point: Vec2)
pub fn apply_torque(&mut self, torque: f32)
pub fn velocity_at_point(&self, point: Vec2) -> Vec2
pub fn world_aabb(&self) -> Aabb2
pub fn rotation_matrix(&self) -> Mat2
pub fn local_to_world(&self, local: Vec2) -> Vec2
pub fn world_to_local(&self, world: Vec2) -> Vec2
Sourcepub fn world_vertices(&self) -> Vec<Vec2>
pub fn world_vertices(&self) -> Vec<Vec2>
Get world-space vertices.
Trait Implementations§
Source§impl Clone for RigidBody2D
impl Clone for RigidBody2D
Auto Trait Implementations§
impl Freeze for RigidBody2D
impl RefUnwindSafe for RigidBody2D
impl Send for RigidBody2D
impl Sync for RigidBody2D
impl Unpin for RigidBody2D
impl UnsafeUnpin for RigidBody2D
impl UnwindSafe for RigidBody2D
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.