Skip to content

Commit

Permalink
Fixes #16480: Prevent exponential denormalization on `Transform::rota…
Browse files Browse the repository at this point in the history
…te_axis`
  • Loading branch information
Novakasa committed Jan 29, 2025
1 parent f7c27b5 commit a4a1078
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/bevy_transform/src/components/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ impl Transform {
/// If this [`Transform`] has a parent, the `axis` is relative to the rotation of the parent.
#[inline]
pub fn rotate_axis(&mut self, axis: Dir3, angle: f32) {
self.rotate(Quat::from_axis_angle(axis.into(), angle));
// Normalize rotation due to potential for exponential denormalization (#16480)
self.rotation = (Quat::from_axis_angle(axis.into(), angle) * self.rotation).normalize();
}

/// Rotates this [`Transform`] around the `X` axis by `angle` (in radians).
Expand Down

0 comments on commit a4a1078

Please sign in to comment.