MapBox 3DPuck не отображает модельIOS

Программируем под IOS
Ответить
Anonymous
 MapBox 3DPuck не отображает модель

Сообщение Anonymous »

Я следовал документации по отображению 3D-шайбы, но она не отображается.
Уже пробовал использовать другой .gltf, .glb или даже .usdz, но все равно безуспешно. Файл также импортирован правильно.
Шайба отображается, если я меняю .puckType на .puck2D().
Неустранимая ошибка не отображается. get, поэтому MapBox успешно получает модель и в файле нет ошибок.
Также пробовал изменить modelScale, но безуспешно. А также непрозрачность модели или ориентацию.
class MapViewController: UIViewController {
var mapView: MapView!
private var cancelables = Set()

override func viewDidLoad() {
super.viewDidLoad()

let options = MapInitOptions()
mapView = MapView(frame: view.bounds, mapInitOptions: options)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(mapView)

mapView.mapboxMap.onStyleLoaded.observeNext { _ in
self.configureMapView()
}.store(in: &cancelables)

setupGestureRecognizers()
}

private func configureMapView() {
// Fetch the asset
guard let uri = Bundle.main.url(forResource: "truck", withExtension: "gltf") else {
fatalError("Failed to locate glb model in asset catalog")
}

// Instantiate the model
let myModel = Model(uri: uri, orientation: [0, 0, 180])

let configuration = Puck3DConfiguration(
model: myModel,
modelScale: .constant([10, 10, 10])
)

mapView.location.options.puckType = .puck3D(configuration)
mapView.location.options.puckBearing = .course
mapView.location.options.puckBearingEnabled = true

mapView.location.onLocationChange.observeNext { [weak mapView] newLocation in
guard let location = newLocation.last, let mapView else { return }
mapView.camera.ease(
to: CameraOptions(
center: location.coordinate,
zoom: 15,
bearing: 0,
pitch: 55),
duration: 1,
curve: .linear,
completion: nil
)
}.store(in: &cancelables)
}
}


Подробнее здесь: https://stackoverflow.com/questions/787 ... ying-model
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»