# Limit User Camera Movement

**URL:** <https://community.cesium.com/t/limit-user-camera-movement/22992>\
**Category:** CesiumJS\
**Created:** [March 22, 2023, 7:39am UTC](https://community.cesium.com/t/limit-user-camera-movement/22992 "2023-03-22T07:39:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![kralkaz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kralkaz/32/12437_2.png) [@kralkaz](https://community.cesium.com/u/kralkaz)\
**Post date:** [March 22, 2023, 7:39am UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/1 "2023-03-22T07:39:05Z")

</div>

Hi,

I am currently working on a project, where the user should not be able to move the camera too far from the original starting point.  
i read the following post:

> [@Movement limit of user](https://community.cesium.com/t/movement-limit-of-user/11248):
>
> Hello, is it possible to limit movement of the user position (camera) to some area? I mean if we want to limit the user to just one country and not to be able to go to the other side of the globe? thank you, Martin

In the post, the solution stated is:  
you can set the [maximumZoomFactor](https://cesium.com/docs/cesiumjs-ref-doc/Camera.html#maximumZoomFactor) to clamp the camera position so that the user can’t zoom too far from the country of interest.  
This does not solve the problem at hand, it just makes it more time consuming to move the camera. I want to be able to set boundries in which the camera is able to move. Is this possible?

Thanks in advance,  
Alex

---

<div class="post-metadata">

**Author:** ![ariel](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ariel/32/3458_2.png) [@ariel](https://community.cesium.com/u/ariel)\
**Post date:** [September 28, 2023, 4:13pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/2 "2023-09-28T16:13:48Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [October 3, 2023, 2:52pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/3 "2023-10-03T14:52:46Z")

</div>

Hi,

This is a running feature request in CesiumJS - [Camera boundry · Issue #4802 · CesiumGS/cesium · GitHub](https://github.com/CesiumGS/cesium/issues/4802). I’ll add this request to that thread.

It’s possible with the existing camera API now, but will require implementing your own boundary behavior.

---

<div class="post-metadata">

**Author:** ![romain97437](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/romain97437/32/14037_2.png) [@romain97437](https://community.cesium.com/u/romain97437)\
**Post date:** [June 10, 2024, 5:08pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/4 "2024-06-10T17:08:44Z")

</div>

I managed to get a working JS Class for limiting cesium camera to a bbox (minx,maxy,miny,maxy,maxz) or to a distance from an entity (position). Contact me if you’re interested.

---

<div class="post-metadata">

**Author:** ![adcomere](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/adcomere/32/14037_2.png) [@adcomere](https://community.cesium.com/u/adcomere)\
**Post date:** [August 6, 2024, 8:30pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/5 "2024-08-06T20:30:58Z")

</div>

I am very interested by your solution Romain.

---

<div class="post-metadata">

**Author:** ![adcomere](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/adcomere/32/14037_2.png) [@adcomere](https://community.cesium.com/u/adcomere)\
**Post date:** [August 6, 2024, 8:31pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/6 "2024-08-06T20:31:51Z")

</div>

Romain could you host your code for me to see somewhere ?

---

<div class="post-metadata">

**Author:** ![romain97437](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/romain97437/32/14037_2.png) [@romain97437](https://community.cesium.com/u/romain97437)\
**Post date:** [August 9, 2024, 5:14am UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/7 "2024-08-09T05:14:45Z")

</div>

I can’t post the code publicly as It is used by one of my client, paying for it.  
Some hints if you want to do it yourself: use viewer.scene.postRender event to test camera position and apply effect.

If you are interested by the whole thing, ready to use, you can contact me to purchase the module.

---

<div class="post-metadata">

**Author:** ![romain97437](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/romain97437/32/14037_2.png) [@romain97437](https://community.cesium.com/u/romain97437)\
**Post date:** [November 25, 2024, 2:38pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/8 "2024-11-25T14:38:05Z")

</div>

I’m working on releasing a final version.

You can sponsor me on github: [Sponsor @romain974 on GitHub Sponsors · GitHub](https://github.com/sponsors/romain974)

My target is 200$ to push the code open source.

Trying to put a demo soon online

---

<div class="post-metadata">

**Author:** ![romain97437](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/romain97437/32/14037_2.png) [@romain97437](https://community.cesium.com/u/romain97437)\
**Post date:** [November 27, 2024, 3:45pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/9 "2024-11-27T15:45:31Z")

</div>

See the demo here: [https://vimeo.com/1033903810?share=copy#t=0](https://vimeo.com/1033903810?share=copy#t=0)

If you want to help me release this open source: [Sponsor @romain974 on GitHub Sponsors · GitHub](https://github.com/sponsors/romain974)

---

<div class="post-metadata">

**Author:** ![Luke\_McKinstry](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/luke_mckinstry/32/25557_2.png) [@Luke\_McKinstry](https://community.cesium.com/u/Luke_McKinstry)\
**Post date:** [December 4, 2024, 3:48pm UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/10 "2024-12-04T15:48:16Z")

</div>

Thanks @romain97437 for sharing your work.

We do not pay or sponsor code contributions into Cesium’s open source software. While we strongly believe that every contributors’ time and effort are valuable, we want to facilitate a community of shared value and growth, where the software helps us create value for everyone together. In that spirit, we encourage you to open a pull request as it would help the Cesium community.

If you are interested, we have other programs like the [Cesium Certified Developer](https://cesium.com/cesium-certified/) and [Ecosystem Grants](https://cesium.com/cesium-ecosystem-grants/) which facilitate developer advancement that you can to apply to.

Please let us know if you have any questions.

---

<div class="post-metadata">

**Author:** ![romain97437](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/romain97437/32/14037_2.png) [@romain97437](https://community.cesium.com/u/romain97437)\
**Post date:** [February 8, 2025, 11:51am UTC](https://community.cesium.com/t/limit-user-camera-movement/22992/11 "2025-02-08T11:51:04Z")

</div>

Hi,

You can find the source code in my open-source repository here: [https://github.com/romain974/cesiumCameraLimiter](https://github.com/romain974/cesiumCameraLimiter).

Feel free to let me know if you encounter any bugs or have suggestions for improvements.

If you find the project useful, I’d greatly appreciate it if you could support it through my [GitHub Sponsors page](https://github.com/sponsors/romain974). Your contributions help me continue improving the project.

Best regards,
