Skip to content

Commit

Permalink
Fix quaternion mapping. (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbohm authored Jan 28, 2024
1 parent f450731 commit b05d476
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,15 @@ where

let scale = 1.0 / ((1 << 14) as f32);

let quat = mint::Quaternion::from([
w as f32 * scale,
x as f32 * scale,
y as f32 * scale,
z as f32 * scale,
]);
let x = x as f32 * scale;
let y = y as f32 * scale;
let z = z as f32 * scale;
let w = w as f32 * scale;

let quat = mint::Quaternion {
v: mint::Vector3 { x, y, z },
s: w,
};

Ok(quat)
} else {
Expand Down

0 comments on commit b05d476

Please sign in to comment.