Skip to content

Stack/03 animation playables#370

Merged
JucanAndreiDaniel merged 7 commits into
mainfrom
stack/03-animation-playables
Jun 15, 2026
Merged

Stack/03 animation playables#370
JucanAndreiDaniel merged 7 commits into
mainfrom
stack/03-animation-playables

Conversation

@JucanAndreiDaniel

@JucanAndreiDaniel JucanAndreiDaniel commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Rewrites the NPC animation system onto Unity's AnimationScriptPlayable with a Burst pose job sampling baked native pose buffers, replacing the old managed keyframe model. This is the foundation for the AI/combat work in later PRs.

Changes

  • Model — removes AnimationKeyFrame; adds AnimationPoseJob (Burst sample+blend over NativeArray pose data) and AnimationSkeleton.
  • TracksAnimationTrack now owns shared native position/rotation buffers (with InvertYAxisflag for sitting poses);AnimationTrackInstance` is reduced to a playbackcursor.
  • BakingAnimationService bakes each .man once: pins root X/Z to zero, storeset, computes root-motion speed, and flags sitting poses.
  • AdapterAnimationSystem schedules the pose job through an AnimationScriptPlayable graph; root motion is applied via RootCollisionHandler.
  • Editor AnimationSystemWindowTool updated for the new pipeline.

How to test

  • Spawn NPCs and confirm idle/walk/turn animations play and blend correctly.
  • Verify sitting poses (bench/throne) are oriented correctly (Y inversion).
  • Confirm root motion (walk translation) advances the NPC and no longer slides.

This is still not foolproof enough, there will still be issues, but the animation doesn't seem to be a bottleneck now on the quest

@JucanAndreiDaniel JucanAndreiDaniel self-assigned this Jun 13, 2026
@JucanAndreiDaniel JucanAndreiDaniel added the improvement Optimize an existing feature label Jun 13, 2026
Base automatically changed from stack/02-vob-loading to main June 14, 2026 08:50
Replaces the O(n) Queue.Contains() guard with a per-loader IsQueued flag, batch-drains the queue (10/frame) skipping destroyed entries, and clears pending entries on world change.
…onSkeleton

Pose sampling/blending now runs as a Burst AnimationPoseJob over native arrays described by AnimationSkeleton, replacing the managed per-keyframe model.
…native samples

AnimationTrack holds shared NativeArray pose buffers (with alias buffer sharing and InvertYAxis); AnimationTrackInstance is reduced to a lightweight playback cursor over them.
Bakes each track's positions/rotations once, pins root X/Z, stores root-Y as a rest-height offset, computes root-motion speed and flags sitting poses for Y inversion.
Schedules AnimationPoseJob through an AnimationScriptPlayable graph and applies baked root motion via RootCollisionHandler.
@JucanAndreiDaniel JucanAndreiDaniel force-pushed the stack/03-animation-playables branch from e28c5ce to 1189242 Compare June 14, 2026 08:52
@JucanAndreiDaniel JucanAndreiDaniel force-pushed the stack/03-animation-playables branch from 1189242 to 175c6f5 Compare June 14, 2026 08:54
@JucanAndreiDaniel JucanAndreiDaniel marked this pull request as ready for review June 14, 2026 08:54

@JaXt0r JaXt0r left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animations are working. Code looks good. I only got a few exceptions during play about Mobs and their usage. E.g., Diego is not sitting on his bench. But I don't expect it's related to the Animation rework.

@JucanAndreiDaniel JucanAndreiDaniel merged commit 4c99734 into main Jun 15, 2026
@JucanAndreiDaniel JucanAndreiDaniel deleted the stack/03-animation-playables branch June 15, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Optimize an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants