Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
AnimationComponent.h File Reference

Skeletal / transform animation system driven by GLTF keyframe data. More...

#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include <glm/gtc/quaternion.hpp>
#include <glm/vec3.hpp>
#include <glm/mat4x4.hpp>
#include "animation/KeyFrame.h"
#include "animation/Pose.h"
#include "scene/Component.h"
+ Include dependency graph for AnimationComponent.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mnd::TransformTrack
 Animation data for one GLTF node: position, rotation, and scale tracks. More...
 
struct  mnd::AnimationClip
 A named, playable animation containing one or more transform tracks. More...
 
struct  mnd::ObjectBinding
 Runtime binding from a TransformTrack to a live child GameObject. More...
 
class  mnd::AnimationComponent
 Drives transform animation on a hierarchy of GameObjects. More...
 

Namespaces

namespace  mnd
 

Detailed Description

Skeletal / transform animation system driven by GLTF keyframe data.

Data model

AnimationClip
└── TransformTrack[] (one per animated GLTF node)
├── KeyFrameVec3[] positions
├── KeyFrameQuat[] rotations
└── KeyFrameVec3[] scales

Each track targets a child GameObject by name (targetName). On Play(), AnimationComponent walks the owner's child hierarchy and caches a binding (ObjectBinding) that maps track indices to live GameObjects.

Per-frame playback

Update() advances m_time by deltaTime, linearly interpolates between the surrounding keyframes for each track, and writes the result directly to the target GameObject's local position / rotation / scale.

Loading

AnimationClips are populated by GameObject::LoadGLTF() from the GLTF animation channels, then registered on this component via RegisterClip().

auto *anim = gunObject->GetComponent<AnimationComponent>();
anim->Play("fire", false); // play once, no loop
See also
GameObject::LoadGLTF, TransformTrack, AnimationClip

Definition in file AnimationComponent.h.