pickVoxel

fun pickVoxel(windowPosition: Cartesian2, width: Double? = definedExternally, height: Double? = definedExternally): VoxelCell?(source)

Returns a VoxelCell for the voxel sample rendered at a particular window coordinate, or undefined if no voxel is rendered at that position.

On left click, report the value of the "color" property at that voxel sample.
handler.setInputAction(function(movement) {
  const voxelCell = scene.pickVoxel(movement.position);
  if (defined(voxelCell)) {
    console.log(voxelCell.getProperty("color"));
  }
}, ScreenSpaceEventType.LEFT_CLICK);

Return

Information about the voxel cell rendered at the picked position or undefined if no voxel is rendered at that position.

Parameters

windowPosition

Window coordinates to perform picking on.

width

Width of the pick rectangle. Default value - 3

height

Height of the pick rectangle. Default value - 3

See also