mapbox / mapbox/mapbox-maps-ios
Camera and Model Position Misalignment at High Pitch Angles
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 601
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- Xcode version: 15.3
- iOS version: 17.4
- Devices affected:
- Maps SDK Version: 11.1.0
Observed behavior and steps to reproduce
I am experiencing an issue with the camera and model position alignment in my project. Specifically, when the pitch angle of the camera exceeds 100 degrees, the camera and model positions become misaligned. At a pitch of 0 degrees, the camera is facing the ground directly and both the camera and model positions are aligned correctly. However, as the pitch increases beyond 100 degrees, this alignment breaks down. I attached the pictures one at 0 pitch and other at 110 pitch for reference.
func cameraPositionInViewR(alt: Double, lat: Double, lng: Double, deviceHeading: Double, pitch: Double = 40) {
let freeCam = self.mapProxy?.map?.freeCameraOptions
// Convert altitude from hundreds of feet to meters
freeCam?.altitude = alt + 200 // View from 100 meters above
freeCam?.location = CLLocationCoordinate2D(latitude: lat, longitude: lng)
freeCam?.setPitchBearingForPitch(pitch, bearing: -285) // Default look straight
mapProxy?.map?.freeCameraOptions = freeCam!
}
Expected behavior
The camera and model positions should remain aligned regardless of the pitch angle.
I suspect this issue might be related to how pitch angles are being handled or interpreted within the freeCameraOptions. Any guidance or suggestions on how to resolve this misalignment issue would be greatly appreciated.
Additional links and references
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
Start with the cameraPositionInViewR function and its use of freeCameraOptions and setPitchBearingForPitch; reproduce the reported behavior at pitch 0 and 110 using Maps SDK 11.1.0 on iOS 17.4. The issue names no repository file or test, so locating the relevant camera implementation and a regression check is part of the work. Done means camera and model positions remain aligned at high pitch angles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100