--- tags: - engine - animation --- # Rigid-Part Animation Models are **hierarchies of separate rigid meshes**, with no skinning and no bones. See [[Decision Log#Rigid-part 3D on SDL_GPU]]. ## Two sources of motion 1. **Authored clips.** glTF supports node (translation, rotation, scale) animation without any skinning. Artists animate parts in Blender (a turret yawing, a barrel recoiling, legs swinging) and export glTF. - The engine samples keyframes for each node, walks the node hierarchy and draws each part as an instance. 2. **Procedural overrides.** C++ systems write to named parts *after* the clip is applied, for example turret aim toward the target, hit recoil, idle bob and death tumble. ## Data ```cpp struct Model { // asset, see Assets Vector nodes; // parent index, local bind TRS, optional mesh + material Map nodeByName; Vector> clips; }; struct Animator { // component Handle clip; float time; float speed; bool loop; Vector nodeWorld; // recomputed each frame }; ``` ## Per-frame order 1. Advance clip time (on `SimClock` for gameplay entities, so it pauses and speeds up with the simulation). 2. Sample clip → local TRS per node. 3. Apply procedural overrides by node name. 4. Compute world matrices down the hierarchy. 5. Push one instance per mesh-bearing node to the [[Rendering]] queue. ## Later - **Vertex animation textures:** if we need thousands of animated enemies. - **Skeletal skinning:** only for a few bosses or heroes, as a separate milestone.