heremaps/harp.gl

Maintaining "North up" in Spherical Map

chrisdalke opened this issue · 3 comments

Hi,
Is there any way to set the map controls to maintain "north up" or a specific camera Z rotation while dragging to orbit the spherical map? I would like to have more control over the direction of the globe, or at least to reset the orientation at the end of every drag motion.

The fundamental issue that I am trying to avoid is that if a user drags slightly off-axis, the Z rotation of the camera will slowly accumulate. Dragging around the earth in a series of smaller motions eventually causes the map to turn upside down, which is disorienting because it doesn't match a user's intent.

Other 3d map renderers handle this in a number of ways:

  • Google maps locks north to always be up
  • CesiumJS defaults to north up, allowing the user to rotate the orientation, but maintains that orientation. If the user hits the north/south pole, the orientation is reset.

@chrisdalke , thanks for the bug. Yes, this makes sense for sure and it is annoying that the error slowly accumulates. We have an internal bug report, I have linked the name of the bug.

We don't have any capacity to look into this currently unfortunately. If that changes, I'll make sure that the developer looking at the ticket also updates this one.

@chrisdalke if you can build harp.gl yourself you can add the following to the bottom of MapControls.mouseMove(), just above this.updateMapView:

        MapViewUtils.setRotation(this.mapView, THREE.MathUtils.radToDeg(0), THREE.MathUtils.radToDeg(0))

If you're not building harp.gl (or not using MapControls) you can add an event listener on MapView for MapViewEventNames.CameraPositionChanged and reset the camera there.

Neither of the above solutions are that great though, as both will give the occasional rendered frame with the camera rotated before the correction kicks in. @nzjony am looking forward to HARP-12051 as well.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.