mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Add model layer above locationPuck or 3D buildings

Open Brez18 opened this issue 6 months ago • 0 comments

I am trying to add my model to the map using the below code, I am making use of the ModelType.LOCATION_INDICATOR and am also specifying the layer position but it does not seem to add it at the right place.

It seems like there is some kind of bug when setting the locationPuck to 3D as reported in #1023. This 3D puck is placed above all layers and cannot be moved even using the slots or specifying the layer position. In addition to this adding a model layer above the 3d buildings also does not work even after specifying the slots or the layer position

Code:

await style.addLayerAt(
                ModelLayer(
                  id: droneID + (droneFeature.id as String) + layerId,
                  sourceId: droneSourceID,
                  modelId: modelDroneId,
                  modelType: ModelType.LOCATION_INDICATOR,
                  modelScale: [
                    5,
                    5,
                    5,
                  ],
                  modelTranslationExpression: [
                    0,
                    0,
                    10,
                  ],
                  modelRotationExpression: [
                    0,
                    0,
                    [
                      getExpression,
                      directionKey,
                    ]
                  ],
                  modelCastShadows: false,
                ),
                LayerPosition(
                  above: 'mapbox-location-model-layer',
                ),
              );

Output:

Model gets added but the layer is below both the userLocationPuck and also the 3d-building

Image

Image

Desired Output:

Model needs to be placed above at least the building or the userLocationPuck

Brez18 avatar Sep 11 '25 15:09 Brez18