cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Camera boundry

Open hpinkos opened this issue 8 years ago • 28 comments

I've seen this requested on the forum a handful of times, most recently here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/z-kWiAZ1Jfg

For some applications, it would be helpful to define a rectangle to restrict the camera to view only a certain span of the map.

hpinkos avatar Jan 03 '17 16:01 hpinkos

I've seen other globes (at least WorldWind I think) handle this using a separate class, we could call ours CameraLimiter or something similar. This class would allow you to set min/max values for anything that makes sense on the Camera. Then every frame, it's job is to check for out of bounds values and set them to the min/max if they are outside the desired configuration. This should provide a flexible and elegant solution and allow us to set limits on all kinds of things (boundary, rotation, direction, etc..)

mramato avatar Jan 03 '17 16:01 mramato

Also reported here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/x8-uWKKlYNc

hpinkos avatar Feb 01 '17 19:02 hpinkos

Also here: https://groups.google.com/d/msg/cesium-dev/tAp48bXcQRw/NmTXbO90AwAJ

rahwang avatar Apr 18 '17 18:04 rahwang

@rahwang this could be a good one for you for next month if you are interested.

pjcozzi avatar Apr 20 '17 22:04 pjcozzi

Yes please! I'll add this to my list

rahwang avatar Apr 20 '17 22:04 rahwang

This will be helpful for something I'm working on too =)

hpinkos avatar Apr 21 '17 16:04 hpinkos

Yep, I would love to see this because we'll have good use for it on cesium.com, has been on my todo list forever. I've has discussions with bagnell in the past on how best to implement this, so let me know if you want to talk before tackling it.

mramato avatar Apr 21 '17 17:04 mramato

CC #3111

pjcozzi avatar Jul 12 '17 13:07 pjcozzi

Sketchfab just added a similar feature: https://blog.sketchfab.com/introducing-camera-constraints/

pjcozzi avatar Jul 12 '17 13:07 pjcozzi

I would appreciate this as well! Even a simple boolean option such as "clampCameraToEdges" for the 2D map would be great. It seems of marginal utility to let people scroll past the north & south poles, as you currently can.

cguinnup avatar Jul 28 '17 15:07 cguinnup

Someone requested this at the FOSS4G cesium workshop as well. I think this would be a really popular feature if anyone has the chance to look at it soon.

hpinkos avatar Aug 14 '17 14:08 hpinkos

It's also a nice onramping issue. @ggetz please add this to your backlog.

pjcozzi avatar Aug 14 '17 15:08 pjcozzi

Any updates on when this feature will make it into a release?

scottnc27603 avatar Aug 18 '17 14:08 scottnc27603

@scottnc27603 no update, but contributions are very welcome if you have the bandwidth.

pjcozzi avatar Aug 19 '17 17:08 pjcozzi

Initial work by @hanbollar in this branch: https://github.com/AnalyticalGraphicsInc/cesium/tree/camera-limiter

See #6381 and #6172

hpinkos avatar Apr 27 '18 15:04 hpinkos

Requested on the forum again: https://groups.google.com/forum/#!topic/cesium-dev/NzcIdGyfSt4

OmarShehata avatar Jul 06 '18 20:07 OmarShehata

@OmarShehata also had some thoughts in https://github.com/AnalyticalGraphicsInc/cesium/issues/8143#issue-491026306

mramato avatar Sep 09 '19 12:09 mramato

where can i get the imp code?

GuniBMB avatar Dec 07 '20 07:12 GuniBMB

Requested in the forum: https://community.cesium.com/t/is-there-any-way-to-constrain-extent/26745/7

ggetz avatar Sep 15 '23 13:09 ggetz

Requested on the forum: https://community.cesium.com/t/limit-user-camera-movement/22992/3

ggetz avatar Oct 03 '23 14:10 ggetz

Hello, is there any update on this feature? I was able to limit (and it works pretty well!) the camera min/max elevation using the: Cesium.ScreenSpaceCameraController.minimumZoomDistance/Cesium.ScreenSpaceCameraController.maximumZoomDistance but i can't find anything in terms of bounding box where the camera should stay

groundrace avatar Mar 17 '24 14:03 groundrace

Hello, is there any update on this feature? I was able to limit (and it works pretty well!) the camera min/max elevation using the: Cesium.ScreenSpaceCameraController.minimumZoomDistance/Cesium.ScreenSpaceCameraController.maximumZoomDistance but i can't find anything in terms of bounding box where the camera should stay

Would also be interested to hear if there are any plans to implement this feature.

Spinksy avatar Apr 09 '24 01:04 Spinksy

I have a working cesium class that allow to limit camera movement by bbox + zmax, or by entity + distance in meter. Contact me if you are interested.

romain974 avatar May 21 '24 09:05 romain974

I have a working cesium class that allow to limit camera movement by bbox + zmax, or by entity + distance in meter. Contact me if you are interested.

Hi @romain974 - could you please guide on how to limit camera movement? Thanks, Matt

mattpgreen avatar Jun 26 '24 00:06 mattpgreen

Hi @romain974 - could you please guide on how to limit camera movement? Thanks, Matt

mattpgreen avatar Jul 16 '24 06:07 mattpgreen

Requested on the forum https://community.cesium.com/t/limit-camera-to-a-zone-volume/34347

jjspace avatar Aug 09 '24 19:08 jjspace

Hi @romain974 - could you please guide on how to limit camera movement? Thanks, Matt Hi @jjspace - could you please guide on this and help @adcomere on #34347 Hi @pjcozzi - could you please help get this function in real soon so that so many local community virtual twins can be implemented and kept with the local focus that's important to them? - thanks, Matt

mattpgreen avatar Aug 12 '24 09:08 mattpgreen

One way to do this by yourself is to use scene postrender event to test camera distance // limit and allow or stop camera move. You also need to store each previous camera value to be able to restore it when camera reach limits. If you wan't a full working code, contact me to purchase the module.

romain974 avatar Aug 12 '24 09:08 romain974

I'm also adding more noise here to express our desire of this feature.

Thank you.

DoisKoh avatar Sep 04 '24 08:09 DoisKoh

I need some time to generate a public, open source code. => JS Class with functions to limit camera by bounding box or distance // cartesian3 + signal when camera hits limits

If you want to contribute to this project: https://github.com/sponsors/romain974?frequency=one-time

Target => mid october

romain974 avatar Sep 09 '24 06:09 romain974