Moving camera to an other position smoothly

Hello!

I have a tiny question, I’m trying to move the camera smoothly from one position (vector3) to an other one . So I thought about using Animation but I wanted to know if it exist an other easier way to do it.

Best regards,
Jez

Hi. Yes, definetly this is the way.
You should fine some examples already done
https://forum.babylonjs.com/search?q=camera%20animation

my favorite :slight_smile:
https://www.babylonjs-playground.com/#HH1U5#87

4 Likes

Hi, What you are seeking may be interpolation.
It moves your camera 5%(0.05) of remaining distance per frame.
https://doc.babylonjs.com/api/classes/babylon.vector3#lerp

scene.registerBeforeRender(function () {
    camera.position = BABYLON.Vector3.Lerp(camera.position,camPosTo,0.05);
});
2 Likes

Hello both of you!
Thank you for your help I tried both options and it works well :smiley:

But now I know and understand more how to use animations correctly and that’s amazing so thank you @MarianG !!! So I will use this method but 감사합니다 @satirev36481 too !!!

3 Likes