feat: add startOffset parameter to gltf playAnimation

This commit is contained in:
Nick Fisher committed 2024-10-23 14:44:29 +08:00
1 parent 96ad9dee18
commit a30e2f295f
16 files changed
+29 -62

No files matched your search

@@ -43,6 +43,7 @@ namespace thermion_filament
struct AnimationStatus
{
time_point_t start = time_point_t::max();
float startOffset;
bool loop = false;
bool reverse = false;
float durationInSecs = 0;
@@ -182,7 +183,7 @@ namespace thermion_filament
auto animationStatus = animationComponent.gltfAnimations[i];
auto elapsedInSecs = float(std::chrono::duration_cast<std::chrono::milliseconds>(now - animationStatus.start).count()) / 1000.0f;
auto elapsedInSecs = animationStatus.startOffset + float(std::chrono::duration_cast<std::chrono::milliseconds>(now - animationStatus.start).count()) / 1000.0f;
if (!animationStatus.loop && elapsedInSecs >= animationStatus.durationInSecs)
{