From a072d4056a51c2965c598efcb35459f01796ea18 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 1 Dec 2020 15:04:30 +0100 Subject: Rename RigidBodyBuilder::principal_inertia -> principal_angular_inertia for clarity. --- src/dynamics/rigid_body.rs | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 98ae47a..86a126f 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -646,9 +646,9 @@ impl RigidBodyBuilder { /// See the documentation of [`RigidBodyBuilder::principal_inertia`] for more details. pub fn lock_rotations(self) -> Self { #[cfg(feature = "dim2")] - return self.principal_inertia(0.0, false); + return self.principal_angular_inertia(0.0, false); #[cfg(feature = "dim3")] - return self.principal_inertia(Vector::zeros(), Vector::repeat(false)); + return self.principal_angular_inertia(Vector::zeros(), Vector::repeat(false)); } /// Sets the mass of the rigid-body being built. @@ -670,7 +670,6 @@ impl RigidBodyBuilder { ); self } - /// Sets the angular inertia of this rigid-body. /// /// In order to lock the rotations of this rigid-body (by @@ -682,7 +681,11 @@ impl RigidBodyBuilder { /// will depend on the initial principal inertia set by this method to which is added /// the contributions of all the colliders with non-zero density attached to this rigid-body. #[cfg(feature = "dim2")] - pub fn principal_inertia(mut self, inertia: f32, colliders_contribution_enabled: bool) -> Self { + pub fn principal_angular_inertia( + mut self, + inertia: f32, + colliders_contribution_enabled: bool, + ) -> Self { self.mass_properties.inv_principal_inertia_sqrt = utils::inv(inertia); self.flags.set( RigidBodyFlags::IGNORE_COLLIDER_ANGULAR_INERTIA_X @@ -693,6 +696,13 @@ impl RigidBodyBuilder { self } + /// Use `self.principal_angular_inertia` instead. + #[cfg(feature = "dim2")] + #[deprecated(note = "renamed to `principal_angular_inertia`.")] + pub fn principal_inertia(self, inertia: f32, colliders_contribution_enabled: bool) -> Self { + self.principal_angular_inertia(inertia, colliders_contribution_enabled) + } + /// Sets the principal angular inertia of this rigid-body. /// /// In order to lock the rotations of this rigid-body (by @@ -706,7 +716,7 @@ impl RigidBodyBuilder { /// to which is added the contributions of all the colliders with non-zero density /// attached to this rigid-body. #[cfg(feature = "dim3")] - pub fn principal_inertia( + pub fn principal_angular_inertia( mut self, inertia: AngVector, colliders_contribution_enabled: AngVector, @@ -727,6 +737,17 @@ impl RigidBodyBuilder { self } + /// Use `self.principal_angular_inertia` instead. + #[cfg(feature = "dim3")] + #[deprecated(note = "renamed to `principal_angular_inertia`.")] + pub fn principal_inertia( + self, + inertia: AngVector, + colliders_contribution_enabled: AngVector, + ) -> Self { + self.principal_angular_inertia(inertia, colliders_contribution_enabled) + } + /// Sets the damping factor for the linear part of the rigid-body motion. /// /// The higher the linear damping factor is, the more quickly the rigid-body -- cgit