Limit Camera to a zone / volume

Hi.
I am prototyping thr website of a treasure hunt based on an island + an app based on GPS tracking and treasures to find in certain zones etc.

The whole game is based on a map and positions.

It seems crucial to limit the zone where users of the map can move the camera to the zone of the game : the said island.

I can not find a way, many people asked and I found issues open for years (almost a decade) on github but it seems not included yet in the current version.

Or am I wrong ? It’s not clear. It seems like an important feature.

I have seen some posts of people saying it’s possible and that they managed to do it, in this thread : Limit User Camera Movement - #4 by romain97437

But it doesn’t seem the users answers and is notified…
I’ve seen some people asking him on github as well but it doesn’t seem active.

For the app I have in mind, it’s a very important part of the game that users are centered on the island, and can not move from it (it’s even part of the lore).

Can someone help maybe ?

Hi @adcomere, thanks for the question.

You are correct that it’s not currently possible to limit the camera movement by default in CesiumJS. We do have an open issue tracking that here Camera boundry · Issue #4802 · CesiumGS/cesium · GitHub

As mentioned in that thread you linked you may be able to get away with writing your own handler and preventing movement of the camera using the scene.postRender handler or writing your own camera controller.

Alright thank you for your answer.
I am still wondering how I will handle this, the quick hacks I tried are very ugly for now, I’d need something smooth.

If someone seens a cool implementation or has some ideas to share please don’t hesitate :slight_smile:

btw cesium is awesome Im having a lot of fun developping my idea :slight_smile: