pub struct PyRigidBodySet { /* private fields */ }Expand description
A collection of rigid bodies with O(1) lookup by handle.
Implementations§
Source§impl PyRigidBodySet
impl PyRigidBodySet
Sourcepub fn add(&mut self, body: PyRigidBody) -> u32
pub fn add(&mut self, body: PyRigidBody) -> u32
Add a body; returns its handle.
Sourcepub fn get(&self, id: u32) -> Option<&PyRigidBody>
pub fn get(&self, id: u32) -> Option<&PyRigidBody>
Get an immutable reference to a body.
Sourcepub fn get_mut(&mut self, id: u32) -> Option<&mut PyRigidBody>
pub fn get_mut(&mut self, id: u32) -> Option<&mut PyRigidBody>
Get a mutable reference to a body.
Sourcepub fn iter(&self) -> impl Iterator<Item = &PyRigidBody>
pub fn iter(&self) -> impl Iterator<Item = &PyRigidBody>
Iterate over all active bodies.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut PyRigidBody>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut PyRigidBody>
Mutable iterator over all active bodies.
Sourcepub fn apply_gravity(&mut self, gravity: [f64; 3])
pub fn apply_gravity(&mut self, gravity: [f64; 3])
Batch: apply gravity to all dynamic bodies.
Sourcepub fn integrate_all(&mut self, dt: f64, gravity: [f64; 3])
pub fn integrate_all(&mut self, dt: f64, gravity: [f64; 3])
Batch: integrate all dynamic bodies forward by dt.
Sourcepub fn total_kinetic_energy(&self) -> f64
pub fn total_kinetic_energy(&self) -> f64
Total kinetic energy of all bodies.
Sourcepub fn sleeping_count(&self) -> usize
pub fn sleeping_count(&self) -> usize
Number of sleeping bodies.
Sourcepub fn awake_count(&self) -> usize
pub fn awake_count(&self) -> usize
Number of awake bodies.
Trait Implementations§
Source§impl Clone for PyRigidBodySet
impl Clone for PyRigidBodySet
Source§fn clone(&self) -> PyRigidBodySet
fn clone(&self) -> PyRigidBodySet
Returns a duplicate of the value. Read more
1.0.0 · 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 PyRigidBodySet
impl Debug for PyRigidBodySet
Source§impl Default for PyRigidBodySet
impl Default for PyRigidBodySet
Source§fn default() -> PyRigidBodySet
fn default() -> PyRigidBodySet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PyRigidBodySet
impl<'de> Deserialize<'de> for PyRigidBodySet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyRigidBodySet
impl RefUnwindSafe for PyRigidBodySet
impl Send for PyRigidBodySet
impl Sync for PyRigidBodySet
impl Unpin for PyRigidBodySet
impl UnsafeUnpin for PyRigidBodySet
impl UnwindSafe for PyRigidBodySet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.