Skip to main content

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
NameTypeDescription
optionsObjectRequiredparameter
nametypedefault valuedescription
bearingNumber0.0optionalThe azimuth angle of the camera after the flight, measured in degrees clockwise from north.
pitchNumber0.0optionalThe pitch angle of the camera after the flight ends.
durationNumber1000optionalFlight duration, in milliseconds.

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

NameTypeDescription
pointObjectRequiredScreen 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.