Requests about how to set max fps below 60

onBeforeRenderObservable, animations, and anythings that are bound to the frame and executed Beyond 60, the behavior becomes erratic (ex When it was a, running became very fast, walking stopped at 165hz)
so want something like engine.setMaximumFps = 60 ( at least 30)
it is possible?

You can use engine.getDeltaTime() or scene.getAnimationRatio() to ensure your animations play back at the same speed on all devices.

You could also simply render once on every 2 RequestAnimationFrame :slight_smile:

Sorry for the slow response.
Here’s the example where I’m having the problem:
a is 1000/60 = It is assumed that 60 frames per second are forced.
time = realTime
testTime = delayed Time

        let a = 0;
        let delta, testTime = 0;
        let time =0;

        scene.onBeforeRenderObservable.add(()=>{

        delta= engine.getDeltaTime();
        time += delta;
        testTime += delta;
        if(time >=0.016) {
            time = 0;
            a++;                        
            if(a >600){
                console.log(`check:  ${testTime}`);
                a = 0;                    
            }
            }                
        })

60fps
1111111
165fps
222222

a = 1000/165 ← Is there a way to explicitly get the user’s frames?

165fps

let a = 0;

let gameLogic = (lastTime) => {
    a++;                 
    if(a >=600){
        console.log(`check:  ${lastTime}`);
        a = 0;                    
    }
  }     

  let desiredFps = 60;
  let interval = 1000 / (10*desiredFps);
  let lastTime = performance.now();

  function loop() {
      window.requestAnimationFrame(loop)
      let currentTime = performance.now();
      const deltaTime = currentTime - lastTime;
      if (deltaTime > interval) {
          lastTime = currentTime - (deltaTime % interval);
          gameLogic(lastTime);
      }
  }
  loop();

1111111

or
let a =0;

let start = new Date().getTime();

let gameLogic = () => {

    a++;

    if (a >= 600) {

        let end = new Date().getTime();

        console.log(`check:  ${end - start}`);

        a = 0;

    }

}

let desiredFps = 60;

let interval = 1000 / (10 * desiredFps);

let lastTime = performance.now();

function loop() {

    window.requestAnimationFrame(loop)

    let currentTime = performance.now();

    const deltaTime = currentTime - lastTime;

    if (deltaTime > interval) {

        lastTime = currentTime - (deltaTime % interval);

        gameLogic();

    }

}

loop();

22222222

Did I get it wrong?

Overall I understand.
I understood the logical relationship between explicitly controlling the fps based on the delay in time, but I thought it was more expensive than I thought when I changed all the logic in this form.
so I’ll modify the recommendation to use 60 fps.
thanks for your answer which brings me closer to the correct answer