Add option to orbit around point at cursor rather than center
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
On Google Earth, when going to orbit the camera in 3D view, it places a "3D cursor" (terminology from Blender) where your cursor is when you start the orbit. The view then rotates around that point, rather than around some invisible center point. (To do this in Google Earth, the shortcut is hold shift, then start dragging)
This lets you inspect a feature much more precisely compared to the current approach in Mapbox Gl Js, where you position the camera near a feature, but when you go to orbit, it orbits around somewhere you don't want, forcing you to awkwardly reposition the camera several times to inspect the feature from all the angles you want to.
## Design Alternatives
Option to show a marker at the current orbit center when panning, to help position the camera correctly initially. This isn't quite as flexible, as you can't start orbiting around any point on visible terrain, but it would certainly make the experience less frustrating.
## Design
1. When the user starts an orbit maneuver/gesture, record the terrain point that their cursor would be on, if you shot a ray out of the camera towards it (so that it's correctly positioned in 3D. This is a bad explanation, try it out on Google Earth to see what I mean).
2. Render some kind of indicator on that point whilst the orbit maneuver/gesture is happening so that the user knows what they'll be orbiting around
3. Orbit around that point for the gesture, using the same mouse controls as currently to change the angles of the camera
### Mock-Up
Developers will likely see a boolean option when creating the map, e.g. `targetedOribiting: true` to enable the new behaviour. Eventually, it may become the new default, and could be opted out of.
End users will see an improved but still intuitive experience for inspecting features in 3D.
### Concepts
- Google Earth is the main precedent for the feature
- Blender also has a 3D cursor feature, but it works differently, as it has a different primary purpose (mainly manipulating 3D objects). However, Blender has similar iconography to Google Earth
- I suggest `targetedOribiting` as a name for the feature, but this is the first workable thing I came up with, I encourage workshopping the name
- Many users should already understand the feature from Google Earth, but the visual indicator will help new users of the feature to understand what they're orbiting around
Google Earth feature demo screen capture: https://github.com/user-attachments/assets/c36cfd18-1b87-4c51-a53e-6b810b481c15
### Implementation
I'm not overly familiar with the internals of Mapbox GL JS, but from a naieve perspective, if the current orbiting code chooses the 'pan position', it should be as simple as changing to projecting the cursor onto terrain and using that position instead, as well as rendering an indicator.
This shouldn't impact 3rd party integrations or developers, beyond providing a better experience.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by locating the current orbit maneuver and terrain ray-projection paths, then trace how map-creation options and gesture rendering are handled. Done means the cursor terrain point can become the orbit center for a gesture, an indicator is shown during it, and the existing orbit controls remain usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100