clampToHeightMostDetailed

suspend fun clampToHeightMostDetailed(    cartesians: <Error class: unknown class><Cartesian3>,     objectsToExclude: <Error class: unknown class><Any>? = definedExternally,     width: Double? = definedExternally): <Error class: unknown class><Cartesian3>(source)

Initiates an asynchronous Scene.clampToHeight query for an array of Cartesian3 positions using the maximum level of detail for 3D Tilesets in the scene. Returns a promise that is resolved when the query completes. Each position is modified in place. If a position cannot be clamped because no geometry can be sampled at that location, or another error occurs, the element in the array is set to undefined.

const cartesians = [
    entities[0].position.getValue(JulianDate.now()),
    entities[1].position.getValue(JulianDate.now())
];
const promise = viewer.scene.clampToHeightMostDetailed(cartesians);
promise.then(function(updatedCartesians) {
    entities[0].position = updatedCartesians[0];
    entities[1].position = updatedCartesians[1];
}

Return

A promise that resolves to the provided list of positions when the query has completed.

Parameters

cartesians

The cartesian positions to update with clamped positions.

objectsToExclude

A list of primitives, entities, or 3D Tiles features to not clamp to.

width

Width of the intersection volume in meters. Default value - 0.1

See also