diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-08-09 09:58:39 +0200 |
|---|---|---|
| committer | Sébastien Crozet <developer@crozet.re> | 2022-08-09 10:06:20 +0200 |
| commit | 68d250f0ad80bb2e5e10e43f2fd1b8824e2a1216 (patch) | |
| tree | 7acbf4b88f03fcf39d2f00ded3d3a07e89769d16 | |
| parent | 1dddb7de9fa5a46baeaa47e3e62bde99ae385cb5 (diff) | |
| parent | a19c6131ff63860aa87f320e3e3770ef4e6f4774 (diff) | |
| download | rapier-68d250f0ad80bb2e5e10e43f2fd1b8824e2a1216.tar.gz rapier-68d250f0ad80bb2e5e10e43f2fd1b8824e2a1216.tar.bz2 rapier-68d250f0ad80bb2e5e10e43f2fd1b8824e2a1216.zip | |
Merge pull request #380 from dimforge/set-rotation
Make Collider::set_rotation and RigidBody::set_rotation take a rotation instead of an axis-angle.
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | src/dynamics/rigid_body.rs | 8 | ||||
| -rw-r--r-- | src/geometry/collider.rs | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e2ae53..5aeb23a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased +### Modified +- The methods `Collider::set_rotation`, `RigidBody::set_rotation`, and `RigidBody::set_next_kinematic_rotation` now + take a rotation (`UnitQuaternion` or `UnitComplex`) instead of a vector/angle. + + ## v0.14.0 (09 July 2022) ### Fixed - Fix unpredictable broad-phase panic when using small colliders in the simulation. diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 9fa05a6..ee64f93 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -681,9 +681,7 @@ impl RigidBody { /// Sets the rotational part of this rigid-body's position. #[inline] - pub fn set_rotation(&mut self, rotation: AngVector<Real>, wake_up: bool) { - let rotation = Rotation::new(rotation); - + pub fn set_rotation(&mut self, rotation: Rotation<Real>, wake_up: bool) { if self.pos.position.rotation != rotation || self.pos.next_position.rotation != rotation { self.changes.insert(RigidBodyChanges::POSITION); self.pos.position.rotation = rotation; @@ -719,9 +717,9 @@ impl RigidBody { } /// If this rigid body is kinematic, sets its future translation after the next timestep integration. - pub fn set_next_kinematic_rotation(&mut self, rotation: AngVector<Real>) { + pub fn set_next_kinematic_rotation(&mut self, rotation: Rotation<Real>) { if self.is_kinematic() { - self.pos.next_position.rotation = Rotation::new(rotation); + self.pos.next_position.rotation = rotation; } } diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs index a9af8d1..efe6304 100644 --- a/src/geometry/collider.rs +++ b/src/geometry/collider.rs @@ -161,9 +161,9 @@ impl Collider { } /// Sets the rotational part of this collider's position. - pub fn set_rotation(&mut self, rotation: AngVector<Real>) { + pub fn set_rotation(&mut self, rotation: Rotation<Real>) { self.changes.insert(ColliderChanges::POSITION); - self.pos.0.rotation = Rotation::new(rotation); + self.pos.0.rotation = rotation; } /// Sets the position of this collider. |
