clampToHeight
Clamps the given cartesian position to the scene geometry along the geodetic surface normal. Returns the clamped position or undefined
if there was no scene geometry to clamp to. May be used to clamp objects to the globe, 3D Tiles, or primitives in the scene.
This function only clamps to globe tiles and 3D Tiles that are rendered in the current view. Clamps to all other primitives regardless of their visibility.
// Clamp an entity to the underlying scene geometry
const position = entity.position.getValue(JulianDate.now());
entity.position = viewer.scene.clampToHeight(position);
Return
The modified result parameter or a new Cartesian3 instance if one was not provided. This may be undefined
if there was no scene geometry to clamp to.
Parameters
The cartesian position.
A list of primitives, entities, or 3D Tiles features to not clamp to.
Width of the intersection volume in meters. Default value - 0.1
An optional object to return the clamped position.