# Let the camera direction follow the direction of the line

**URL:** <https://community.cesium.com/t/let-the-camera-direction-follow-the-direction-of-the-line/32576>\
**Category:** CesiumJS\
**Created:** [May 30, 2024, 3:31pm UTC](https://community.cesium.com/t/let-the-camera-direction-follow-the-direction-of-the-line/32576 "2024-05-30T15:31:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lafeu-p](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/lafeu-p/32/23808_2.png) [@Lafeu-p](https://community.cesium.com/u/Lafeu-p)\
**Post date:** [May 30, 2024, 3:31pm UTC](https://community.cesium.com/t/let-the-camera-direction-follow-the-direction-of-the-line/32576/1 "2024-05-30T15:31:07Z")

</div>

![image](https://global.discourse-cdn.com/cesium/original/3X/2/b/2bc2d0d2037ff934da1756110d139e0f7ebc6985.jpeg)

I want to point the camera in A direction that can follow A line, like two points A and B, so that the camera looks at point A towards B.

```auto
const cartesian2 = ellipsoid.cartographicToCartesian(new Cesium.Cartographic(-84.0, 50, 0));
const cartesian1 = ellipsoid.cartographicToCartesian(new Cesium.Cartographic(-100.0, 30.0, 1000000.0));

const direction = new Cesium.Cartesian3(cartesian2.x - cartesian1.x, cartesian2.y - cartesian1.y, cartesian2.z - cartesian1.z);
const normalizedDirection = Cesium.Cartesian3.normalize(direction, new Cesium.Cartesian3());

const camera = scene.camera;

camera.setView({
  destination: Cesium.Cartesian3.fromDegrees(
    -100.0,
    30.0,
    1000000.0,
  ),
  orientation: {
    direction: normalizedDirection,
    up: Cesium.Cartesian3.UNIT_Y
  },
});

```

My code is shown as above, but it does not meet my requirements. I do not know what is wrong with the above code. Can anyone familiar with Cesium help to solve this problem?  
Any help is greatly appreciated
