Skip to content

Instantly share code, notes, and snippets.

@vrana
Created May 5, 2020 15:29
Show Gist options
  • Save vrana/632770c5bcab74c5769ff0e8507c93f5 to your computer and use it in GitHub Desktop.
Save vrana/632770c5bcab74c5769ff0e8507c93f5 to your computer and use it in GitHub Desktop.
Cesium obscured line
const lat = 50.6494;
const lng = 15.74;
const degrees = 195;
const place = {"latitude":50.6341,"longitude":15.7263};
const terrainProvider = Cesium.createWorldTerrain();
const terrainExaggeration = 1.5;
const cesium = new Cesium.Viewer('cesiumContainer', {
terrainProvider,
terrainExaggeration,
});
cesium.scene.globe.depthTestAgainstTerrain = false;
const position = Cesium.Cartesian3.fromDegrees(lng, lat, 1343 * terrainExaggeration);
cesium.camera.lookAt(position, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(degrees), Cesium.Math.toRadians(-30), 300));
cesium.trackedEntity = cesium.entities.add({
position: Cesium.Cartesian3.fromDegrees(place.longitude, place.latitude),
polyline: {
width: 10,
material: Cesium.Color.RED,
positions: [position, Cesium.Cartesian3.fromDegrees(place.longitude, place.latitude)],
clampToGround: true,
},
});
cesium.trackedEntity = undefined;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment