Skip to content

Commit

Permalink
Merge pull request #80 from urholaukkarinen/77-fix-rotation-errors
Browse files Browse the repository at this point in the history
Updated rotation is properly normalized (#77)
  • Loading branch information
urholaukkarinen authored Oct 5, 2024
2 parents 79dd894 + b340e0b commit 8dbdd1e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/transform-gizmo/src/gizmo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Gizmo {
) -> Transform {
let axis = match self.config.orientation() {
GizmoOrientation::Local if !is_view_axis => {
DQuat::from(transform.rotation) * DVec3::from(axis)
(DQuat::from(transform.rotation) * DVec3::from(axis)).normalize()
}
_ => DVec3::from(axis),
};
Expand All @@ -259,9 +259,11 @@ impl Gizmo {
TransformPivotPoint::IndividualOrigins => transform.translation,
};

let new_rotation = (delta * DQuat::from(transform.rotation)).normalize();

Transform {
scale: transform.scale,
rotation: (delta * DQuat::from(transform.rotation)).into(),
rotation: new_rotation.into(),
translation,
}
}
Expand Down

0 comments on commit 8dbdd1e

Please sign in to comment.