Skip to content

feat(core): GlobeController with inertia, tilt & pan#10298

Merged
felixpalmer merged 6 commits into
masterfrom
felix/globe-inertia-bearing
May 14, 2026
Merged

feat(core): GlobeController with inertia, tilt & pan#10298
felixpalmer merged 6 commits into
masterfrom
felix/globe-inertia-bearing

Conversation

@felixpalmer
Copy link
Copy Markdown
Collaborator

Background

Alternative implementation to #10249

The current GlobeController has several limitations:

  • No support for bearing or pitch
  • The transitions are also not implemented in a way that allows use of inertia in the controller
  • Polar axis is always forced to be up

Approach

This PR adds a set of utilities that perform full 3D spherical calculations, both when processing input and animating transitions by simulating a rigid sphere

Back compatibility

When the bearing is 0, the old behavior is retained, with the polar axis kept pointing up. Inertia is enabled in this mode to give a more responsive feel though

Screen.Recording.2026-05-13.at.14.59.05.mov

New behavior

When the bearing is changed, the polar lock is removed and the globe can move freely in all directions

Screen.Recording.2026-05-13.at.15.02.41.mov

Notice how the bearing changes during the transition in order the keep the orientation valid

Touches outside globe

The input handling is unchanged, in that pointer events outside the globe are treated the same as inside. No attempt is made to "grab" an exact point on the sphere and anchor it as it leads to strange behavior at the edge of the sphere

Changes

  • Add globe-utils.ts with Globe spherical math helper and GlobeInertiaInterpolator for transitions
  • Update GlobeController to defer to Globe when updating viewport
  • Track last positions of globe to simulate physics for inertia parameter
  • doc updates

@charlieforward9
Copy link
Copy Markdown
Collaborator

Polished!

It did occur to me recently, that we should consider combining the logic in your new TerrainController into the GlobeController by default as well to avoid passing this responsibility to the user.

Agree?

@felixpalmer
Copy link
Copy Markdown
Collaborator Author

should consider combining the logic in your new TerrainController into the GlobeController

Indeed, perhaps we could switch to TerrainController rather than MapController at high zooms. I say we land this PR first though

@coveralls
Copy link
Copy Markdown

coveralls commented May 13, 2026

Coverage Status

coverage: 83.519% (-0.3%) from 83.791% — felix/globe-inertia-bearing into master

Copy link
Copy Markdown
Collaborator

@chrisgervang chrisgervang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work you guys, this feels intuitive!

Comment thread modules/core/src/controllers/globe-controller.ts
Comment thread modules/core/src/controllers/globe-controller.ts
Comment thread modules/core/src/controllers/globe-controller.ts
Comment thread modules/core/src/viewports/globe-utils.ts
Comment thread modules/core/src/viewports/globe-viewport.ts Outdated
felixpalmer and others added 2 commits May 14, 2026 11:03
@felixpalmer felixpalmer merged commit 5405738 into master May 14, 2026
5 checks passed
@felixpalmer felixpalmer deleted the felix/globe-inertia-bearing branch May 14, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants