Hi community,
Is there a way to change engine FPS to any fixed FPS number I desire?
I created this cam animation in Unreal, 100 frames, 30 FPS,
but when I import it into babylon, the animation duration becomes 200 frames, at the same time while engine FPS is set to 60 FPS by default.

Is there anyway I can play the animation in 30FPS with original 100 frames?
I am from offline render industry, real-time engine is still new to me…
Many thanks,
Tawibox.
yes you can but you should get the exactly same outcome (I guess)
We are normalizing animations at load time (based on glTF spec)
cc @bghgary for additional info maybe?
I’m not sure the question is about glTF, but if it is, there is an option on the glTF loader that specifies what the FPS is, but like @Deltakosh says, it won’t actually change the result because glTF stores animations in seconds.
1 Like
@Deltakosh @bghgary
Thank you! I will definitely try load gltf in the right fps first. And for the engine FPS, can you provide some example code how to set it up? I only found getFps()
func but couldn’t find one how to set it up.
Many thanks,
@Deltakosh @bghgary
Also if gltf store animation in seconds, but I when load an animation in, I do see an array storing all the animation frames. For my example, it stores animation in a 100
length array. So what is the proper way to play my animation in original 30 FPS in babylon? - in original speed as Unreal?
Maybe we should take a step back. Unreal should be export animations to glTF as time-based (second-based) key frames. If that is happening, then you should be getting the correct animation playback in Babylon.js. Can you set up a repro in a playground so that I can see what is happening?
@bghgary @Deltakosh Finally figured everything out!
So it turns out the targetFps
on GLTFFileLoader
is the solution:
https://doc.babylonjs.com/typedoc/classes/BABYLON.GLTFFileLoader#targetFps
As long as I set it up the correctly the imported animation will have the correct frame number mapping:
Before there was an offset, which was wrong:

Also sorry for the confusions, I got the “engine FPS” and “playback FPS” mixed up in the first place. All my issues in this thread has nothing to do with the engine FPS. So as long as set up the targetFps
correctly when loading a gltf file, all the animation will be properly loaded into the scene.
Thank you so much for all the help!
All good now.
Best regards,
Tawibox
4 Likes