From a19c6131ff63860aa87f320e3e3770ef4e6f4774 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Tue, 9 Aug 2022 09:26:12 +0200 Subject: Make Collider::set_rotation and RigidBody::set_rotation take a rotation instead of an axis-angle. --- CHANGELOG.md | 6 ++++++ src/dynamics/rigid_body.rs | 4 +--- src/geometry/collider.rs | 4 ++-- 3 files changed, 9 insertions(+), 5 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..f03a4b6 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, wake_up: bool) { - let rotation = Rotation::new(rotation); - + pub fn set_rotation(&mut self, rotation: Rotation, 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; 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) { + pub fn set_rotation(&mut self, rotation: Rotation) { self.changes.insert(ColliderChanges::POSITION); - self.pos.0.rotation = Rotation::new(rotation); + self.pos.0.rotation = rotation; } /// Sets the position of this collider. -- cgit