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:
In the post, the solution stated is:
you can set the 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?
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.
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.
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.
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. Your contributions help me continue improving the project.