Merge pull request #380 from dimforge/set-rotation
Make Collider::set_rotation and RigidBody::set_rotation take a rotation instead of an axis-angle.
This commit is contained in:
@@ -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)
|
## v0.14.0 (09 July 2022)
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix unpredictable broad-phase panic when using small colliders in the simulation.
|
- Fix unpredictable broad-phase panic when using small colliders in the simulation.
|
||||||
|
|||||||
@@ -681,9 +681,7 @@ impl RigidBody {
|
|||||||
|
|
||||||
/// Sets the rotational part of this rigid-body's position.
|
/// Sets the rotational part of this rigid-body's position.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_rotation(&mut self, rotation: AngVector<Real>, wake_up: bool) {
|
pub fn set_rotation(&mut self, rotation: Rotation<Real>, wake_up: bool) {
|
||||||
let rotation = Rotation::new(rotation);
|
|
||||||
|
|
||||||
if self.pos.position.rotation != rotation || self.pos.next_position.rotation != rotation {
|
if self.pos.position.rotation != rotation || self.pos.next_position.rotation != rotation {
|
||||||
self.changes.insert(RigidBodyChanges::POSITION);
|
self.changes.insert(RigidBodyChanges::POSITION);
|
||||||
self.pos.position.rotation = rotation;
|
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.
|
/// 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() {
|
if self.is_kinematic() {
|
||||||
self.pos.next_position.rotation = Rotation::new(rotation);
|
self.pos.next_position.rotation = rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ impl Collider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the rotational part of this collider's position.
|
/// 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.changes.insert(ColliderChanges::POSITION);
|
||||||
self.pos.0.rotation = Rotation::new(rotation);
|
self.pos.0.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the position of this collider.
|
/// Sets the position of this collider.
|
||||||
|
|||||||
Reference in New Issue
Block a user