mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Remove unnecessary compute for rotation interpolation (#14019)
# Objective - `slerp` has a built-in short path check. And quaternions are ensured to be normalized during loading . ## Solution - remove it ## Testing `many_foxes ` in single thread ![image](https://github.com/bevyengine/bevy/assets/45868716/a7e74050-e202-4adb-9179-82a87263c300)
This commit is contained in:
parent
d8b45ca136
commit
dbffb41e50
1 changed files with 3 additions and 6 deletions
|
@ -957,13 +957,10 @@ impl AnimationTargetContext<'_> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let rot_start = keyframes[step_start];
|
let rot_start = keyframes[step_start];
|
||||||
let mut rot_end = keyframes[step_start + 1];
|
let rot_end = keyframes[step_start + 1];
|
||||||
// Choose the smallest angle for the rotation
|
|
||||||
if rot_end.dot(rot_start) < 0.0 {
|
|
||||||
rot_end = -rot_end;
|
|
||||||
}
|
|
||||||
// Rotations are using a spherical linear interpolation
|
// Rotations are using a spherical linear interpolation
|
||||||
let rot = rot_start.normalize().slerp(rot_end.normalize(), lerp);
|
let rot = rot_start.slerp(rot_end, lerp);
|
||||||
transform.rotation = transform.rotation.slerp(rot, weight);
|
transform.rotation = transform.rotation.slerp(rot, weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue