Hi everyone,
I first noticed this in the Inspector:
The To-frame can be 72 or 144.
To reproduce, I need to reload the game. Then, whenever I play a walk animation before the screenshot animation, it is 144. If I play the screenshot animation immediately, it is 72. Once the game is running, the value remains the same.
I have also double checked:
// render loop
const debug = scene.getAnimationGroupByName("RollForwardAndStandWithAny");
if(debug) {
console.log(debug.to); //either 72 or 144 as described above
}
Confirms what the Inspector shows. So it seems whatever happens, happens on load.
Load means SceneLoader.ImportMeshAsync
and then grabbing the AnimationGroup.
Inspecting the loaded AnimationGroups, right after load, I see differences in fps:
- In the 144 case: targetedAnimations of screenshot AnimationGroup has 60fps.
- In the 72 case: targetedAnimations of screenshot AnimationGroup has 30fps.
How can the loading or playing of one animation, cause a not yet loaded animation to have a different number of frames / fps?
If there is no easy answer: Where does ImportMeshAsync actually create AnimationGroups from a GLB?
I got to the GLTFLoader which seems to be one place where fps are applied to animations. The fps value comes from a parent GLTFFileLoader from a “targetFps” property. This is 60 by default but can be set by an options parameter. But there I lose track. Nothing seems to access targetFps or the glTFFileLoader
Might be a dead end though because this does not make a difference:
BABYLON.SceneLoader.OnPluginActivatedObservable.addOnce(function (loader) {
if(loader.name === "gltf") {
loader.targetFps = 30;
}
});
Best wishes
Joe