pub struct SimBodyState {
pub handle: u32,
pub position: [f64; 3],
pub velocity: [f64; 3],
pub orientation: [f64; 4],
pub angular_velocity: [f64; 3],
pub is_sleeping: bool,
pub is_static: bool,
pub tag: Option<String>,
}Expand description
Serializable state of a single rigid body within a snapshot.
Fields§
§handle: u32Slot handle (u32 index in the world).
position: [f64; 3]Position [x, y, z] in world space.
velocity: [f64; 3]Linear velocity [vx, vy, vz].
orientation: [f64; 4]Orientation quaternion [x, y, z, w].
angular_velocity: [f64; 3]Angular velocity [wx, wy, wz].
is_sleeping: boolWhether this body is currently sleeping.
is_static: boolWhether this body is static.
tag: Option<String>Optional user tag.
Implementations§
Source§impl SimBodyState
impl SimBodyState
Sourcepub fn at_rest(handle: u32, position: [f64; 3]) -> Self
pub fn at_rest(handle: u32, position: [f64; 3]) -> Self
Create a SimBodyState with default motion (at rest, identity orientation).
Sourcepub fn angular_speed(&self) -> f64
pub fn angular_speed(&self) -> f64
Angular speed (magnitude of angular velocity).
Sourcepub fn kinetic_energy_proxy(&self) -> f64
pub fn kinetic_energy_proxy(&self) -> f64
Kinetic energy estimate using a unit-mass approximation.
Sourcepub fn distance_from_origin(&self) -> f64
pub fn distance_from_origin(&self) -> f64
Distance from origin.
Sourcepub fn is_at_rest(&self, linear_threshold: f64, angular_threshold: f64) -> bool
pub fn is_at_rest(&self, linear_threshold: f64, angular_threshold: f64) -> bool
Whether the body is effectively at rest (speed < threshold).
Trait Implementations§
Source§impl Clone for SimBodyState
impl Clone for SimBodyState
Source§fn clone(&self) -> SimBodyState
fn clone(&self) -> SimBodyState
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 SimBodyState
impl Debug for SimBodyState
Source§impl<'de> Deserialize<'de> for SimBodyState
impl<'de> Deserialize<'de> for SimBodyState
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
Source§impl PartialEq for SimBodyState
impl PartialEq for SimBodyState
Source§impl Serialize for SimBodyState
impl Serialize for SimBodyState
impl StructuralPartialEq for SimBodyState
Auto Trait Implementations§
impl Freeze for SimBodyState
impl RefUnwindSafe for SimBodyState
impl Send for SimBodyState
impl Sync for SimBodyState
impl Unpin for SimBodyState
impl UnsafeUnpin for SimBodyState
impl UnwindSafe for SimBodyState
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.