mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Terrain pitching not updating NavigationControl or firing pitch events

Open leigeber opened this issue 3 years ago • 6 comments

The new terrain option is great but if you zoom into the side of a mountain for instance the camera will pitch without updating the pitch control or firing pitch events.

Steps to Trigger Behavior

  1. Create a map
  2. Add a NavigationControl with visualizePitch
  3. Add the raster-dem source and setTerrain
  4. Zoom into a mountain and see the control doesn't update

Link to Demonstration

https://jsfiddle.net/zq3v6h9p/

leigeber avatar Dec 13 '20 17:12 leigeber

Pitch is defined relative to the zero plane, not to the mountain geometry the camera looks at, so I'd say this is working as designed as pitch doesn't change when you zoom in. Would would you need it to be defined by terrain?

mourner avatar Dec 14 '20 13:12 mourner

Thanks for the reply. Sure, totally understood about defining the plane. But with terrain on as you zoom in close to the ground (anywhere, the mountains were just an example), I'm saying that since the camera seems to change the pitch on its own, which I'm assuming is intentional (not that I like that behavior in our use case), the control in the example as you see no longer aligns with the on-screen pitch anymore. Hope that makes more sense.

leigeber avatar Dec 14 '20 14:12 leigeber

Oh, just noticed the pitch shift on higher zooms — sorry, misunderstood earlier. Let me check back on this — we might have introduced some constraints to pitch when close to the ground, but I can see how this behavior can be confusing.

mourner avatar Dec 14 '20 15:12 mourner

Hey @mourner, sorry to bug you but wanted to follow up on this. Any plans to allow disabling the auto-pitch? Pretty major pain point for us. If this is better to route through support let me know. Thanks!

leigeber avatar May 05 '21 00:05 leigeber

@avpeery any update would be appreciated.

erinc35 avatar Jan 07 '22 17:01 erinc35

MapLibre released their terrain without auto-pitch behavior, which is exactly what we're after. Any update?

https://maplibre.org/maplibre-gl-js-docs/example/3d-terrain/

leigeber avatar Sep 01 '22 14:09 leigeber