Skip to content

Instantly share code, notes, and snippets.

@vrana

vrana/script.js

Created May 5, 2020
Embed
What would you like to do?
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