mapbox / mapbox/mapbox-maps-flutter

Add model layer above locationPuck or 3D buildings

Open
#1,025 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/user-attachments/assets/44348afd-d7f3-458b-9966-528bb581cfe8)

![Image](https://github.com/user-attachments/assets/52da2c0a-9b70-4464-83ff-dd8b61e4302e)

### Desired Output:

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown addLayerAt, ModelLayer, and LayerPosition configuration, then compare the location puck behavior with the related report in #1023. Trace how model layers are ordered relative to the userLocationPuck and 3D buildings; done means the model can be placed above at least one of those layers as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.