# Is there a way to change engine FPS?

**URL:** <https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783>\
**Category:** Questions\
**Tags:** engine\
**Created:** [April 17, 2024, 8:18pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783 "2024-04-17T20:18:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tawibox](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawibox/32/22881_2.png) [@tawibox](https://forum.babylonjs.com/u/tawibox)\
**Post date:** [April 17, 2024, 8:18pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/1 "2024-04-17T20:18:47Z")

</div>

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.

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#WUYDVT%23127)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/9/499d10972a1d0e7aeae2e90a10428bc394095c30.png)

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.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 17, 2024, 9:48pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/2 "2024-04-17T21:48:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [April 17, 2024, 9:49pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/3 "2024-04-17T21:49:59Z")

</div>

I’m not sure the question is about glTF, but if it is, there is [an option on the glTF loader](https://doc.babylonjs.com/typedoc/classes/BABYLON.GLTFFileLoader#targetFps) that specifies what the FPS is, but like @Deltakosh says, it won’t actually change the result because glTF stores animations in seconds.

---

<div class="post-metadata">

**Author:** ![tawibox](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawibox/32/22881_2.png) [@tawibox](https://forum.babylonjs.com/u/tawibox)\
**Post date:** [April 18, 2024, 1:17am UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/4 "2024-04-18T01:17:44Z")

</div>

@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,

---

<div class="post-metadata">

**Author:** ![tawibox](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawibox/32/22881_2.png) [@tawibox](https://forum.babylonjs.com/u/tawibox)\
**Post date:** [April 18, 2024, 1:23am UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/5 "2024-04-18T01:23:06Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [April 18, 2024, 3:43pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/6 "2024-04-18T15:43:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tawibox](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawibox/32/22881_2.png) [@tawibox](https://forum.babylonjs.com/u/tawibox)\
**Post date:** [June 13, 2024, 10:18pm UTC](https://forum.babylonjs.com/t/is-there-a-way-to-change-engine-fps/49783/7 "2024-06-13T22:18:31Z")

</div>

@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](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:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/6/e6de303fc38ac43259ff6cd68d8912c33d21bc4e.png)

Before there was an offset, which was wrong:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/2/7/278209a6105ec8b36dde1417489bd4ec7c08bac6.png)

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
