pub struct PyRigidBodyConfig {Show 14 fields
pub mass: f64,
pub position: [f64; 3],
pub velocity: [f64; 3],
pub orientation: [f64; 4],
pub angular_velocity: [f64; 3],
pub shapes: Vec<PyColliderShape>,
pub friction: f64,
pub restitution: f64,
pub is_static: bool,
pub is_kinematic: bool,
pub can_sleep: bool,
pub linear_damping: f64,
pub angular_damping: f64,
pub tag: Option<String>,
}Expand description
Configuration for creating a new rigid body.
Passed to PyPhysicsWorld::add_rigid_body.
Fields§
§mass: f64Mass in kilograms. Use 0.0 or f64::INFINITY for a static/kinematic body.
position: [f64; 3]Initial position [x, y, z].
velocity: [f64; 3]Initial linear velocity [vx, vy, vz]. Defaults to zero.
orientation: [f64; 4]Initial orientation as quaternion [x, y, z, w]. Defaults to identity.
angular_velocity: [f64; 3]Initial angular velocity [wx, wy, wz]. Defaults to zero.
shapes: Vec<PyColliderShape>Collider shapes attached to this body.
friction: f64Friction coefficient (0 = frictionless, 1 = high friction).
restitution: f64Restitution/bounciness (0 = perfectly inelastic, 1 = perfectly elastic).
is_static: boolWhether this body is static (immovable, infinite mass).
is_kinematic: boolWhether this body is kinematic (moved manually, not by forces).
can_sleep: boolWhether this body can go to sleep when motion is negligible.
linear_damping: f64Linear damping coefficient (drag).
angular_damping: f64Angular damping coefficient (rotational drag).
tag: Option<String>Optional user-defined tag/name for identification.
Implementations§
Source§impl PyRigidBodyConfig
impl PyRigidBodyConfig
Sourcepub fn dynamic(mass: f64, position: [f64; 3]) -> Self
pub fn dynamic(mass: f64, position: [f64; 3]) -> Self
Create a dynamic body at the given position with default settings.
Sourcepub fn static_body(position: [f64; 3]) -> Self
pub fn static_body(position: [f64; 3]) -> Self
Create a static body at the given position with default settings.
Sourcepub fn with_shape(self, shape: PyColliderShape) -> Self
pub fn with_shape(self, shape: PyColliderShape) -> Self
Add a collider shape to this body config and return self for chaining.
Sourcepub fn with_friction(self, friction: f64) -> Self
pub fn with_friction(self, friction: f64) -> Self
Set friction and return self for chaining.
Sourcepub fn with_restitution(self, restitution: f64) -> Self
pub fn with_restitution(self, restitution: f64) -> Self
Set restitution and return self for chaining.
Sourcepub fn with_linear_damping(self, damping: f64) -> Self
pub fn with_linear_damping(self, damping: f64) -> Self
Set linear damping and return self for chaining.
Sourcepub fn with_angular_damping(self, damping: f64) -> Self
pub fn with_angular_damping(self, damping: f64) -> Self
Set angular damping and return self for chaining.
Sourcepub fn inverse_mass(&self) -> f64
pub fn inverse_mass(&self) -> f64
Effective inverse mass (0 for static/infinite).
Trait Implementations§
Source§impl Clone for PyRigidBodyConfig
impl Clone for PyRigidBodyConfig
Source§fn clone(&self) -> PyRigidBodyConfig
fn clone(&self) -> PyRigidBodyConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PyRigidBodyConfig
impl Debug for PyRigidBodyConfig
Source§impl Default for PyRigidBodyConfig
impl Default for PyRigidBodyConfig
Source§impl<'de> Deserialize<'de> for PyRigidBodyConfig
impl<'de> Deserialize<'de> for PyRigidBodyConfig
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>,
Auto Trait Implementations§
impl Freeze for PyRigidBodyConfig
impl RefUnwindSafe for PyRigidBodyConfig
impl Send for PyRigidBodyConfig
impl Sync for PyRigidBodyConfig
impl Unpin for PyRigidBodyConfig
impl UnsafeUnpin for PyRigidBodyConfig
impl UnwindSafe for PyRigidBodyConfig
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.