pub struct RigidBody3D { /* private fields */ }Expand description
A 3D rigid body participating in the physics simulation.
Implementations§
Source§impl RigidBody3D
Implements body creation and force management for RigidBody3D.
impl RigidBody3D
Implements body creation and force management for RigidBody3D.
Sourcepub fn new_dynamic(id: u64, position: Vector3D) -> RigidBody3D
pub fn new_dynamic(id: u64, position: Vector3D) -> RigidBody3D
Sourcepub fn new_static(id: u64, position: Vector3D) -> RigidBody3D
pub fn new_static(id: u64, position: Vector3D) -> RigidBody3D
Sourcepub fn apply_force(&mut self, force: Vector3D)
pub fn apply_force(&mut self, force: Vector3D)
Sourcepub fn apply_torque(&mut self, torque: Vector3D)
pub fn apply_torque(&mut self, torque: Vector3D)
Sourcepub fn apply_impulse(&mut self, impulse: Vector3D)
pub fn apply_impulse(&mut self, impulse: Vector3D)
Applies an instantaneous impulse, directly changing velocity.
§Arguments
Vector3D- The impulse vector.
Sourcepub fn update_mass(&mut self, mass: f64)
pub fn update_mass(&mut self, mass: f64)
Sets the mass of the body, updating the inverse mass. A mass of 0 makes the body static (infinite mass).
§Arguments
f64- The new mass.
Sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
Returns true if this body is affected by forces and collisions.
§Returns
bool- True if the body is dynamic.
Sourcepub fn update_collider(&mut self, collider: BodyCollider3D)
pub fn update_collider(&mut self, collider: BodyCollider3D)
Sourcepub fn bounding_box(&self) -> Option<AABB3D>
pub fn bounding_box(&self) -> Option<AABB3D>
Returns the world-space 3D bounding box of the attached collider, if any.
§Returns
Option<AABB3D>- The bounding box, orNoneif no collider is attached.
Source§impl RigidBody3D
impl RigidBody3D
pub fn get_id(&self) -> u64
pub fn get_mut_id(&mut self) -> &mut u64
pub fn set_id(&mut self, val: u64) -> &mut Self
pub fn get_position(&self) -> Vector3D
pub fn set_position(&mut self, val: Vector3D) -> &mut Self
pub fn get_velocity(&self) -> Vector3D
pub fn set_velocity(&mut self, val: Vector3D) -> &mut Self
pub fn get_rotation(&self) -> Quaternion
pub fn set_rotation(&mut self, val: Quaternion) -> &mut Self
pub fn get_angular_velocity(&self) -> Vector3D
pub fn set_angular_velocity(&mut self, val: Vector3D) -> &mut Self
pub fn get_mass(&self) -> f64
pub fn set_mass(&mut self, val: f64) -> &mut Self
pub fn get_restitution(&self) -> f64
pub fn get_mut_restitution(&mut self) -> &mut f64
pub fn set_restitution(&mut self, val: f64) -> &mut Self
pub fn get_friction(&self) -> f64
pub fn get_mut_friction(&mut self) -> &mut f64
pub fn set_friction(&mut self, val: f64) -> &mut Self
pub fn get_body_type(&self) -> BodyType
pub fn get_mut_body_type(&mut self) -> &mut BodyType
pub fn set_body_type(&mut self, val: BodyType) -> &mut Self
pub fn get_collider(&self) -> Option<BodyCollider3D>
pub fn try_get_collider(&self) -> Option<BodyCollider3D>
pub fn get_mut_collider(&mut self) -> &mut Option<BodyCollider3D>
pub fn set_collider(&mut self, val: Option<BodyCollider3D>) -> &mut Self
Trait Implementations§
Source§impl Clone for RigidBody3D
impl Clone for RigidBody3D
Source§fn clone(&self) -> RigidBody3D
fn clone(&self) -> RigidBody3D
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RigidBody3D
impl Debug for RigidBody3D
Source§impl PartialEq for RigidBody3D
impl PartialEq for RigidBody3D
Source§fn eq(&self, other: &RigidBody3D) -> bool
fn eq(&self, other: &RigidBody3D) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RigidBody3D
Auto Trait Implementations§
impl Freeze for RigidBody3D
impl RefUnwindSafe for RigidBody3D
impl Send for RigidBody3D
impl Sync for RigidBody3D
impl Unpin for RigidBody3D
impl UnsafeUnpin for RigidBody3D
impl UnwindSafe for RigidBody3D
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