Inconsistent animation duration with mesh.getAbsolutePosition()

I am trying to animate a mesh from its current position to a target position over the period of several dozen seconds. I have been using mesh.getAbsolutePosition() in order to get the starting position for the animation keys, but the duration/speed of the animation is accelerated considerably when doing this, and I’ve been unable to decipher why?


If instead, I just use the (in this case) knwon starting position of new Vector(0,0,0) then the duration of the animation is correct.

Any assistance would be most welcome.


Just noticed that the animation duration defaults to 1 second when using getAbsolutePosition()

Just to clear up a misunderstanding engine.getFps() refers to the rendering frame rate used by Babylon.js and this is not the same as the animation frame rate which you fix for yourself.

frames per second - number , the number of animation frames per second (independent of the scene rendering frames per second)

from The Animation Method | Babylon.js Documentation

So if you have 100 animation frames that you want to render of 6 seconds the frame rate is 100 / 6

and the frame count goes from 0 to 100.

The other point is about using absolutePosition.
This PG uses the position of the sphere and as it has a parent it is the position of the sphere relative to its parent (see line 31)

This PG uses absolutePosition

See how the sphere jumps. In

let sphereMove = new BABYLON.Animation("sphereMove",

Your start point is the absolutePosition of the sphere but it is the sphere’s position not absolutePosition that is being updated within the animation.

As far I I know there is not a parameteryou can add for absolutePosition in BABYLON.Animation

1 Like

Thank you for the great clarification John