# How to compute offset between entities

**URL:** <https://community.cesium.com/t/how-to-compute-offset-between-entities/14292>\
**Category:** CesiumJS\
**Created:** [July 2, 2021, 5:43pm UTC](https://community.cesium.com/t/how-to-compute-offset-between-entities/14292 "2021-07-02T17:43:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugleb](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/bugleb/32/3237_2.png) [@bugleb](https://community.cesium.com/u/bugleb)\
**Post date:** [July 2, 2021, 5:43pm UTC](https://community.cesium.com/t/how-to-compute-offset-between-entities/14292/1 "2021-07-02T17:43:09Z")

</div>

I’m wanting to implement a feature that allows entities (observer and target) to track each other. That is, the camera is positioned at one entity and faces the other. Doing this with the Camera API has been pretty simple and successful but I’d really like to take advantage of `viewer.trackedEntity` and `entity.viewFrom` if possible because I would like to take advantage of the zoom functionality (slowly scaling down zoom as you get closer tot he entity) rather than manually implementing it myself. The `offset` piece of `entity.viewFrom` is where I’m getting stuck… I need a way to calculate the offset in such a way that it puts the camera at the other entity’s (the observer) position. My math skills have failed my thus far.

Anybody have any experience with this and can shed some light how it might be accomplished?
