Reputation: 1376
I want to display a custom 3D object (e.g. OBJ, GLTF, GLB...) in a Mapbox map on Android/iOS. Is this possible?
I am not familiar with Mapbox yet, but am considering using it. I tried to Google and search their doc for an answer but couldn't come to a conclusion. I saw:
But I believe that is for something different (Mapbox GL JS), right? Or does this mean that it is also possible on Android/iOS somehow?
Upvotes: 2
Views: 458
Reputation: 13
Yes, in v10 mapbox android sdk(may be ios also) supports showing custom 3d models.
visit this https://docs.mapbox.com/android/maps/guides/migrate-to-v10/#3d-model-capabilities
mapView.location.enabled = true
mapView.location.locationPuck = LocationPuck3D(
modelUri = "asset://sportcar.glb",
modelScale = listOf(0.1f, 0.1f, 0.1f)
)
The LocationModelLayer options can be configured by:
data class LocationPuck3D(
/**
* An URL for the model file in gltf format.
*/
var modelUri: String,
/**
* The scale of the model.
*/
var position: List<Float> = listOf(0f, 0f),
/**
* The opacity of the model.
*/
var modelOpacity: Float = 1f,
/**
* The scale of the model.
*/
var modelScale: List<Float> = listOf(1f, 1f, 1f),
/**
* The scale expression of the model, which will overwrite the default scale
expression that keeps the model size constant during zoom.
*/
var modelScaleExpression: String? = null,
/**
* The rotation of the model.
*/
var modelRotation: List<Float> = listOf(0f, 0f, 90f),
) : LocationPuck()
Upvotes: 0