Skip to content

Fix critical bugs in animation system: slerp, keyframe sampling, asset loading#65

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/improve-animation-system
Draft

Fix critical bugs in animation system: slerp, keyframe sampling, asset loading#65
Copilot wants to merge 5 commits intomainfrom
copilot/improve-animation-system

Conversation

Copy link

Copilot AI commented Feb 16, 2026

Animation system had multiple bugs rendering it non-functional: broken quaternion interpolation, uninitialized keyframe sampling, incorrect asset deserialization, and unimplemented sampling logic.

Quaternion slerp fix (AnimationInterpolation.cpp)

Return value had wrong component mapping. Constructor is Quaternion(w, x, y, z) but brace-init was {x, w, z, w}:

// Before (broken)
return { k1*vk.x + k2*vk1.x, k1*vk.w + k2*vk1.w, k1*vk.z + k2*vk1.z, k1*vk.w + k2*vk1.w };

// After
return { k1*vk.w + k2*vk1.w, k1*vk.x + k2*vk1.x, k1*vk.y + k2*vk1.y, k1*vk.z + k2*vk1.z };

Keyframe sampling fix (AnimationInterpolation.h)

  • AnimSampleChannel never populated vk1/vk2 from channel data and t was always 0 — now properly extracts surrounding keyframes and computes interpolation parameter
  • Handles edge cases: timepoint before first key or after last key
  • Fixed call to undefined SphericalLinear()AnimSphericalLinear()
  • Fixed (1-t) * vkvk * (1-t)Vector3 has no free operator*(float, Vector3)

Asset loading fix (AnimationAsset.cpp)

Copy-paste error: rotation time data was loaded into channel.position.time instead of channel.rotation.time.

Implement AnimationNodeChannel::Sample

Was an empty stub. Now delegates to AnimSampleChannel for each non-empty channel (position, scale, rotation) and writes results to a new AnimNodeSampleResult struct.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 16, 2026 02:00
…ion name, asset loading

1. Fix quaternion slerp (AnimSphericalLinear) component assignment - was using
   wrong components (w instead of y, duplicated w)
2. Fix AnimSampleChannel to properly extract keyframe data and compute
   interpolation parameter t from actual channel data instead of using
   uninitialized defaults
3. Fix function name mismatch: SphericalLinear -> AnimSphericalLinear
4. Fix AnimInterpolateLinear to use member operator* (T*float) instead of
   non-existent free function (float*T)
5. Fix copy-paste bug in AnimationAsset::Load - rotation time was loaded
   into position.time instead of rotation.time
6. Implement AnimationNodeChannel::Sample() with actual keyframe sampling
7. Add AnimNodeSampleResult struct for node channel sampling output

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
…allback

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot AI changed the title [WIP] Check and enhance animation system Fix critical bugs in animation system: slerp, keyframe sampling, asset loading Feb 16, 2026
Copilot AI requested a review from bluesky013 February 16, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants