diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-03-19 16:23:09 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2022-03-20 21:49:16 +0100 |
| commit | a9e3441ecd64d50b478ab5370fabe187ec9a5c39 (patch) | |
| tree | 92b2e4ee3d3599a446f15551cc74e8e71b9c6150 /src/dynamics/rigid_body.rs | |
| parent | db6a8c526d939a125485c89cfb6e540422fe6b4b (diff) | |
| download | rapier-a9e3441ecd64d50b478ab5370fabe187ec9a5c39.tar.gz rapier-a9e3441ecd64d50b478ab5370fabe187ec9a5c39.tar.bz2 rapier-a9e3441ecd64d50b478ab5370fabe187ec9a5c39.zip | |
Rename rigid-body `static` to `fixed`
Diffstat (limited to 'src/dynamics/rigid_body.rs')
| -rw-r--r-- | src/dynamics/rigid_body.rs | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 1bfdf48..695b256 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -112,7 +112,7 @@ impl RigidBody { self.changes.insert(RigidBodyChanges::TYPE); self.rb_type = status; - if status == RigidBodyType::Static { + if status == RigidBodyType::Fixed { self.rb_vels = RigidBodyVelocity::zero(); } } @@ -372,11 +372,11 @@ impl RigidBody { self.rb_type.is_kinematic() } - /// Is this rigid body static? + /// Is this rigid body fixed? /// - /// A static body cannot move and is not affected by forces. - pub fn is_static(&self) -> bool { - self.rb_type == RigidBodyType::Static + /// A fixed body cannot move and is not affected by forces. + pub fn is_fixed(&self) -> bool { + self.rb_type == RigidBodyType::Fixed } /// The mass of this rigid body. @@ -487,7 +487,7 @@ impl RigidBody { /// Is this rigid body sleeping? pub fn is_sleeping(&self) -> bool { // TODO: should we: - // - return false for static bodies. + // - return false for fixed bodies. // - return true for non-sleeping dynamic bodies. // - return true only for kinematic bodies with non-zero velocity? self.rb_activation.sleeping @@ -531,7 +531,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.linvel = linvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -553,7 +553,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.angvel = angvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -575,7 +575,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.angvel = angvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -905,7 +905,7 @@ pub struct RigidBodyBuilder { } impl RigidBodyBuilder { - /// Initialize a new builder for a rigid body which is either static, dynamic, or kinematic. + /// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic. pub fn new(rb_type: RigidBodyType) -> Self { Self { position: Isometry::identity(), @@ -925,23 +925,39 @@ impl RigidBodyBuilder { } } - /// Initializes the builder of a new static rigid body. + /// Initializes the builder of a new fixed rigid body. + #[deprecated(note = "use `RigidBodyBuilder::fixed()` instead")] pub fn new_static() -> Self { - Self::new(RigidBodyType::Static) + Self::fixed() } - - /// Initializes the builder of a new kinematic rigid body. + /// Initializes the builder of a new velocity-based kinematic rigid body. + #[deprecated(note = "use `RigidBodyBuilder::kinematic_velocity_based()` instead")] pub fn new_kinematic_velocity_based() -> Self { + Self::kinematic_velocity_based() + } + /// Initializes the builder of a new position-based kinematic rigid body. + #[deprecated(note = "use `RigidBodyBuilder::kinematic_position_based()` instead")] + pub fn new_kinematic_position_based() -> Self { + Self::kinematic_position_based() + } + + /// Initializes the builder of a new fixed rigid body. + pub fn fixed() -> Self { + Self::new(RigidBodyType::Fixed) + } + + /// Initializes the builder of a new velocity-based kinematic rigid body. + pub fn kinematic_velocity_based() -> Self { Self::new(RigidBodyType::KinematicVelocityBased) } - /// Initializes the builder of a new kinematic rigid body. - pub fn new_kinematic_position_based() -> Self { + /// Initializes the builder of a new position-based kinematic rigid body. + pub fn kinematic_position_based() -> Self { Self::new(RigidBodyType::KinematicPositionBased) } /// Initializes the builder of a new dynamic rigid body. - pub fn new_dynamic() -> Self { + pub fn dynamic() -> Self { Self::new(RigidBodyType::Dynamic) } |
