editor icon indicating copy to clipboard operation
editor copied to clipboard

Imported animation has an extra second added to the end when imported

Open yaustar opened this issue 4 years ago • 1 comments

See thread: https://forum.playcanvas.com/t/animation-of-skinned-mesh-object-loops-with-a1-second-pause/19456/6

The animation is 599 frames at 29fps (~20.6 secs) but when imported, the duration is at (~21.5 secs).

Setting the sample rate at 0 doesn't seem to change anything either.

yaustar avatar Apr 15 '21 09:04 yaustar

This looks suspicious: there's a // TODO: calculate duration in ConvertAnimation in FACT's scene.cpp. Should it be doing something like:

    float duration = 0.0f;
    for (const auto &node : result->nodes)
    {
        if (!node.pos.times.empty()) duration = std::max(duration, node.pos.times.back());
        if (!node.rot.times.empty()) duration = std::max(duration, node.rot.times.back());
        if (!node.quat.times.empty()) duration = std::max(duration, node.quat.times.back());
        if (!node.scale.times.empty()) duration = std::max(duration, node.scale.times.back());
        if (!node.blendshapes.times.empty()) duration = std::max(duration, node.blendshapes.times.back());
    }
    result->duration = duration;

willeastcott avatar Dec 14 '25 18:12 willeastcott