CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.92k stars 3.48k forks source link

Camera boundry #4802

Open hpinkos opened 7 years ago

hpinkos commented 7 years ago

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.

mramato commented 7 years ago

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..)

hpinkos commented 7 years ago

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

rahwang commented 7 years ago

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

pjcozzi commented 7 years ago

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

rahwang commented 7 years ago

Yes please! I'll add this to my list

hpinkos commented 7 years ago

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

mramato commented 7 years ago

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.

pjcozzi commented 7 years ago

CC #3111

pjcozzi commented 7 years ago

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

cguinnup commented 7 years ago

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.

hpinkos commented 7 years ago

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.

pjcozzi commented 7 years ago

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

scottnc27603 commented 7 years ago

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

pjcozzi commented 7 years ago

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

hpinkos commented 6 years ago

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

See #6381 and #6172

OmarShehata commented 6 years ago

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

mramato commented 5 years ago

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

GuniBMB commented 3 years ago

where can i get the imp code?

ggetz commented 1 year ago

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

ggetz commented 1 year ago

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

groundrace commented 7 months ago

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

Spinksy commented 6 months ago

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.

romain974 commented 5 months ago

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.

mattpgreen commented 4 months ago

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 commented 3 months ago

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

jjspace commented 2 months ago

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

mattpgreen commented 2 months ago

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

romain974 commented 2 months ago

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.

DoisKoh commented 2 months ago

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

Thank you.

romain974 commented 1 month ago

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