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?
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)
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) https://playground.babylonjs.com/#X6RG4E#7
let sphereMove = new BABYLON.Animation("sphereMove",
"position",
FRAME_RATE,
BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
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