# Camera lookat point

**URL:** https://community.cesium.com/t/camera-lookat-point/3066
**Category:** CesiumJS
**Created:** [September 15, 2015, 6:41pm UTC](https://community.cesium.com/t/camera-lookat-point/3066 "2015-09-15T18:41:35Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![amacleod](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amacleod](https://community.cesium.com/u/amacleod)
#### Post date: [September 15, 2015, 6:41pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/1 "2015-09-15T18:41:35Z")

</div>

Hi, I'm trying to do something straightforward, with a given lat,lng,height (the camera position), orient the camera to 'lookat' a given point; e.g. another latlng on the ground). Thought this would be simple and perhaps a bit like it is in other 3d APIS where I would position the camera in cartesian space and then construct a lookat matrix to orient the camera. Obviously things are a bit different in Cesium with polar coords but can anyone point me in the right direction? Thanks  
A.

---

<div class="post-metadata">

### Author: ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)
#### Post date: [September 16, 2015, 1:50am UTC](https://community.cesium.com/t/camera-lookat-point/3066/2 "2015-09-16T01:50:13Z")

</div>

Cesium works just like the “other 3d APIS” you describe, what made you think we use polar coordinates? I think what you want is [lookAtTransform](http://cesiumjs.org/Cesium/Build/Documentation/Camera.html#lookAtTransform), but you might also want lookAt or setView, both of which are also documented in that link.

---

<div class="post-metadata">

### Author: ![amacleod](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@amacleod](https://community.cesium.com/u/amacleod)
#### Post date: [September 16, 2015, 11:19am UTC](https://community.cesium.com/t/camera-lookat-point/3066/3 "2015-09-16T11:19:48Z")

</div>

What I'm looking for is this deprecated method 'lookAt' which apparently used to be found here: [http://cesiumjs.org/releases/b26/Build/Documentation/CameraController.html](http://cesiumjs.org/releases/b26/Build/Documentation/CameraController.html)

.lookAt(eye, target, up)

Similarly found here:  
[http://threejs.org/docs/#Reference/Cameras/Camera](http://threejs.org/docs/#Reference/Cameras/Camera)  
[https://msdn.microsoft.com/en-us/library/windows/desktop/bb281710(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/windows/desktop/bb281710(v=vs.85).aspx)  
[https://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml](https://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml)  
etc

I assume there's an equivalent in Cesium? Many thanks

---

<div class="post-metadata">

### Author: ![Ruediger\_Brand](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ruediger_brand/32/4004_2.png) [@Ruediger\_Brand](https://community.cesium.com/u/Ruediger_Brand)
#### Post date: [July 28, 2021, 1:27pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/4 "2021-07-28T13:27:52Z")

</div>

Hi,

I’m looking for such a function as well - can anyone help ?

I have two points P1 and P2, P1 should be the camera position and I want to look at P2 with the camera. Has anyone experience how to set the parameters from lookat ?

Rüdiger

---

<div class="post-metadata">

### Author: ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)
#### Post date: [July 28, 2021, 2:27pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/5 "2021-07-28T14:27:20Z")

</div>

Hi @Ruediger_Brand,

The `Camera` in CesiumJS has a `lookAt` function here. It takes a `target` and an `offset`, such that it will find the `target` and then `offset` itself by the amount specified.  
[https://cesium.com/learn/cesiumjs/ref-doc/Camera.html#lookAt](https://cesium.com/learn/cesiumjs/ref-doc/Camera.html#lookAt)

Hope that helps!

Best,  
Janine

---

<div class="post-metadata">

### Author: ![Ruediger\_Brand](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ruediger_brand/32/4004_2.png) [@Ruediger\_Brand](https://community.cesium.com/u/Ruediger_Brand)
#### Post date: [July 28, 2021, 2:49pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/6 "2021-07-28T14:49:19Z")

</div>

But this doen’t work in my opinion ! What is the target and waht is the offset, if I want to set the camera to P1 - in another topic I found that the the offset should be P1-P2. but that doesn’t work.

---

<div class="post-metadata">

### Author: ![janine](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/janine/32/5135_2.png) [@janine](https://community.cesium.com/u/janine)
#### Post date: [July 28, 2021, 2:52pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/7 "2021-07-28T14:52:54Z")

</div>

Hi @Ruediger_Brand,

You defined P1 and P2 as follows in your last response:

> I have two points P1 and P2, P1 should be the camera position and I want to look at P2 with the camera. Has anyone experience how to set the parameters from lookat ?

So given this, you actually want P2 to be the `target`, and `P2-P1` to be the offset.

Best,  
Janine

---

<div class="post-metadata">

### Author: ![Ruediger\_Brand](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ruediger_brand/32/4004_2.png) [@Ruediger\_Brand](https://community.cesium.com/u/Ruediger_Brand)
#### Post date: [July 28, 2021, 2:54pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/8 "2021-07-28T14:54:53Z")

</div>

ok - i will try this again

---

<div class="post-metadata">

### Author: ![Ruediger\_Brand](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ruediger_brand/32/4004_2.png) [@Ruediger\_Brand](https://community.cesium.com/u/Ruediger_Brand)
#### Post date: [July 28, 2021, 3:00pm UTC](https://community.cesium.com/t/camera-lookat-point/3066/9 "2021-07-28T15:00:37Z")

</div>

ok - I have checked it again, it works but it changes the camera position !

so I think the solution of omar I found now is better

// ['viewer.camera.lookAt' method change camera.heading and camera.pitch](https://community.cesium.com/t/viewer-camera-lookat-method-change-camera-heading-and-camera-pitch/8800)
