# Camera animation from one vector point to another

**URL:** <https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628>\
**Category:** Questions\
**Tags:** tutorial\
**Created:** [June 12, 2020, 3:30am UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628 "2020-06-12T03:30:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rita1097](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@rita1097](https://forum.babylonjs.com/u/rita1097)\
**Post date:** [June 12, 2020, 3:30am UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628/1 "2020-06-12T03:30:24Z")

</div>

Hello, I’m looking for some help on how to animate an Arc camera from one vector point to another. Right now, when the user clicks the directional button, the camera should move in the direction that they pointed. So I currently have a vector3 that has the current camera points, then the destination vector points. I want to animate it so that the camera smoothly moves from the current point to the destination point.

I’ve tried:  
let easing = new QuadraticEase()  
easing.setEasingMode(EasingFunction.EASINGMODE\_EASEIN)  
Animation.CreateAndStartAnimation(  
“slideIn”,  
camera,  
“position”,  
30,  
60,  
current,  
destination,  
0,  
easing,  
callback  
)

and also:  
let animationcamera = new BABYLON.Animation(  
“myAnimationcamera”,  
“position”,  
60,  
BABYLON.Animation.ANIMATIONTYPE\_VECTOR3,  
);

```
let keys = [
  {
    frame: 0,
    value: current,
    outTangent: new BABYLON.Vector3(0.1,0.1,0)
  },
  {
    frame: 30,
    value: destination,
    inTangent: new BABYLON.Vector3(0.1,0.1,0)
  }
];

animationcamera.setKeys(keys)
camera.animations = []
camera.animations.push(animationcamera)

scene.beginAnimation(camera, 0, 30, false, 0.2)

```

The issue is always that the camera “snaps” into place and doesn’t smoothly move from one spot to the other. Please help! Thanks!

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [June 12, 2020, 3:43am UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628/2 "2020-06-12T03:43:11Z")

</div>

@rita1097 please check out this post and PG example from @Wingnut, although the correct PG link is [https://www.babylonjs-playground.com/#UTINNB#6](https://www.babylonjs-playground.com/#UTINNB#6)

> [@How to calculate translation with respect to rotation](https://forum.babylonjs.com/t/how-to-calculate-translation-with-respect-to-rotation/1435/8):
>
> Hi gang. I made another one. slight_smile[https://www.babylonjs-playground.com/indexStable.html#UTINNB#6](https://www.babylonjs-playground.com/indexStable.html#UTINNB#6) Many/most BJS cameras have a property called .[lockedTarget](https://doc.babylonjs.com/api/classes/babylon.arcrotatecamera#lockedtarget). It can be a mesh or a vec3. It sort-of “freezes” the camera-\>target relationship/orientation, so when you move the .lockedTarget, the camera rides-along, automatically. Lines 3-11… is an overload of camera… adding .aniLockedTarget() func. Most people say that overloading is unhealthy, but I don’t know any better. …

---

<div class="post-metadata">

**Author:** ![rita1097](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@rita1097](https://forum.babylonjs.com/u/rita1097)\
**Post date:** [June 12, 2020, 2:43pm UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628/3 "2020-06-12T14:43:01Z")

</div>

Thanks for your reply. Unfortunately, that link won’t work for me ☹ it is not loading the page

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [June 12, 2020, 3:49pm UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628/4 "2020-06-12T15:49:31Z")

</div>

Colon got mixed in with the url should be [https://www.babylonjs-playground.com/#UTINNB#6](https://www.babylonjs-playground.com/#UTINNB#6)

Alternative, clicked on grey box becomes camera position [https://www.babylonjs-playground.com/#DXE1CV#1](https://www.babylonjs-playground.com/#DXE1CV#1)

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [June 12, 2020, 7:22pm UTC](https://forum.babylonjs.com/t/camera-animation-from-one-vector-point-to-another/11628/5 "2020-06-12T19:22:33Z")

</div>

> [@rita1097](#):
>
> that link won’t work for me

Oops, sorry. Fixed.
