![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
What drives a rig: the skeleton, the clip playing on it, and the playback position. More...
#include <animator.h>
Static Public Member Functions | |
| static void | crossFadeTo (Animator &animator, AnimationClipHandle clip, float seconds, bool looping) |
Start playing clip, blending out of whatever is playing now. | |
Public Attributes | |
| SkeletonHandle | skeleton |
| The rig posed; nothing is posed without it. | |
| AnimationClipHandle | clip |
| Clip playing on it; empty holds the bind pose. | |
| float | time = 0.0f |
| Playback head in seconds; session state, not serialized. | |
| float | speed = 1.0f |
| Multiplies the simulation delta. | |
| bool | looping = true |
| Whether the clip in clip wraps at its end or stops there. | |
| bool | playOnStart = true |
| Start playing on the first frame the simulation runs. | |
| bool | playing = false |
| Session state. | |
| bool | started = false |
| Whether playOnStart has been honoured this session. Session state. | |
| AnimationClipHandle | fadeFrom |
| Clip being left; empty when nothing is fading. | |
| float | fadeTime = 0.0f |
| Its own playback head; it keeps playing while it fades. | |
| float | fadeRemaining = 0.0f |
| Simulation seconds of blend left. | |
| float | fadeDuration = 0.0f |
| fadeRemaining's start; the weight divides by it. | |
| bool | fadeLooping = true |
| Whether the outgoing clip wraps while it fades out; parked here by crossFadeTo. | |
| std::vector< BoneAdjust > | adjust |
| Per-bone additions on top of the clip; session state. | |
What drives a rig: the skeleton, the clip playing on it, and the playback position.
One per character, on the rig: import spawns a sub-entity per mesh, and a pose per mesh would be clocks drifting apart. A mesh is skinned when its MeshAsset carries skin weights, and its rig is the nearest Animator at or above it in the Hierarchy, so no EntityId needs remapping.
Playback and blend state are not serialized: a saved scene reloads as the clip it was blending to.
|
static |
Start playing clip, blending out of whatever is playing now.
The outgoing clip keeps advancing while it fades; the blend runs in simulation seconds, unscaled by speed. A call mid-fade drops the clip on its way out, so the pose jumps by its remaining weight.
| animator | Animator to retarget, in place. |
| clip | Clip to play; the same clip already playing is left alone, a stopped one plays again. |
| seconds | Blend length; zero or less is a cut, as is having no clip to blend out of. |
| looping | Whether clip wraps; taken here so the outgoing clip keeps the answer it played under. |
| float Vkm::Engine::Animator::time = 0.0f |
Playback head in seconds; session state, not serialized.
A start phase a game wants is set by the behavior that spawns the character.
| bool Vkm::Engine::Animator::looping = true |
Whether the clip in clip wraps at its end or stops there.
crossFadeTo parks the outgoing clip's answer on fadeLooping.
| bool Vkm::Engine::Animator::playOnStart = true |
Start playing on the first frame the simulation runs.
The only one of playOnStart / playing / started that is serialized; see engine.md, "Authored state and session state on one component".
| std::vector<BoneAdjust> Vkm::Engine::Animator::adjust |
Per-bone additions on top of the clip; session state.
Read by composePose whenever the pose is composed, including frames the behavior does not run (a paused editor), and never cleared: write an identity or drop the entry. Entries naming one bone compose in list order.