Migrates existing GDD and engine design notes from HacknPlan into a new Obsidian vault. This establishes a centralized, version-controlled knowledge base covering engine architecture, game constraints, design decisions, and open questions.
44 lines
1.6 KiB
Markdown
44 lines
1.6 KiB
Markdown
---
|
|
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<ModelNode> nodes; // parent index, local bind TRS, optional mesh + material
|
|
Map<StringId, UInt16> nodeByName;
|
|
Vector<Handle<AnimationClip>> clips;
|
|
};
|
|
|
|
struct Animator { // component
|
|
Handle<AnimationClip> clip; float time; float speed; bool loop;
|
|
Vector<glm::mat4> 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.
|