aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2020-12-01 15:14:43 +0100
committerGitHub <noreply@github.com>2020-12-01 15:14:43 +0100
commitcacee0d2a07f5089e7b6bb43f319714b16ecc303 (patch)
tree5dbf8b9865fef8009f63446f15c84fc708f351c6 /src
parent29d4814266a2c8cd82beea8e63226157aca675fc (diff)
parenta072d4056a51c2965c598efcb35459f01796ea18 (diff)
downloadrapier-cacee0d2a07f5089e7b6bb43f319714b16ecc303.tar.gz
rapier-cacee0d2a07f5089e7b6bb43f319714b16ecc303.tar.bz2
rapier-cacee0d2a07f5089e7b6bb43f319714b16ecc303.zip
Merge pull request #71 from dimforge/principal_inertia_rename
Rename RigidBodyBuilder::principal_inertia -> principal_angular_inertia for clarity.
Diffstat (limited to 'src')
-rw-r--r--src/dynamics/rigid_body.rs31
1 files changed, 26 insertions, 5 deletions
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<f32>,
colliders_contribution_enabled: AngVector<bool>,
@@ -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<f32>,
+ colliders_contribution_enabled: AngVector<bool>,
+ ) -> 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