Skip to content

Commit 579dfd5

Browse files
committed
use slerp instead of lerp in rotations
1 parent 69d4fc4 commit 579dfd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/3d/load_gltf_animation.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ fn gltf_animation_driver(
169169
if rot_end.dot(rot_start) < 0.0 {
170170
rot_end = -rot_end;
171171
}
172-
let result = rot_start.lerp(rot_end, lerp);
173-
transform.rotation = Quat::from_array(result.normalize().into());
172+
let result = Quat::from_array(rot_start.normalize().into())
173+
.slerp(Quat::from_array(rot_end.normalize().into()), lerp);
174+
transform.rotation = result;
174175
}
175176
GltfNodeAnimationKeyframes::Translation(keyframes) => {
176177
let translation_start = keyframes[step_start.0];

0 commit comments

Comments
 (0)