What's the difference between engine.getDeltaTime and scene.getAnimationRatio?

Hi,

I’m trying to understand the difference between engine.getDeltaTime and scene.getAnimationRatio. Can someone help me to understand it?

Another thing that I noticed is: when using FollowCamera to follow an object that is moved using elapsedTime = engine.getDeltaTime, the camera goes tremulous. If I remove the elapsed time, the camera movement is smooth. Am I making something wrong?

I’m using this code to move my object:

let elapsedTime = (GAME.engine.getDeltaTime() / 1000),
     gravity = (this.godMode) ? 0 : (this.gravity / 100);

this.mesh.moveWithCollisions(new BABYLON.Vector3(
            0, 
            gravity, 
            this.speed * elapsedTime
));

Thanks by help!

Hello!
So Delta time is the time in ms between two frames.

getAnimationRatio will return a ratio (a factor ) so let’s say you are running at 60fps then the ratio will be 1. If you run a 30fps then the ratio will be 2

So the idea is to use the ratio and multiply it by your step

2 Likes

Thanks @Deltakosh I’ll try changing from delta time to animation ratio.

Regards,
Tiago