Tilt model layer (3DTilesLayer)
method
flyToSelf
When adding a tilted model, it can automatically locate the perspective of the model to avoid the situation where the model cannot be seen or cannot be found after loading.
Parameters
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| options | Object | Requiredparameter
|
Case
map.addLayer({
id: "tile-3d-layer",
type: "3DTiles",
data: "<your 3dtiles url>",
callback: function (group, layer) {
layer.flyToSelf({
pitch: 60, // tilt angle
duration: 3000, // flight time
});
},
});
Refer to Example.
pickCoordinate
Pick the coordinates of 3DTiles data in the map. For specific usage, refer to the case below.
Parameters
| Name | Type | Description |
|---|---|---|
| point | Object | RequiredScreen coordinates, such as {x: 1152, y: 643}. |
Case
const TILESET_URL = "<your 3dtiles url>";
map.addLayer(
{
id: 'tile-3d-layer',
type: "3DTiles",
data: TILESET_URL,
callback: function (group, layer) {
Layer = layer;
}
}
)
map.on('click', e => {
let result = Layer.pickCoordinate(e.point)
console.log(result);
});
Reference Example.