Last active
March 30, 2023 20:23
-
-
Save JoeThunyathep/56cdf17e36530678f7590820e294fa24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Cesium 3D Tileset Example</title> | |
<script src="https://cesium.com/downloads/cesiumjs/releases/1.103/Build/Cesium/Cesium.js"></script> | |
<link rel="stylesheet" href="https://cesium.com/downloads/cesiumjs/releases/1.103/Build/Cesium/Widgets/widgets.css"> | |
<style> | |
#cesiumContainer { | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
overflow: hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="cesiumContainer"></div> | |
<script> | |
Cesium.Ion.defaultAccessToken = '<Your Access Token Here>'; | |
var viewer = new Cesium.Viewer('cesiumContainer', { | |
terrainProvider: Cesium.createWorldTerrain() | |
}); | |
var tileset = new Cesium.Cesium3DTileset({ | |
url: Cesium.IonResource.fromAssetId(96188) | |
}); | |
viewer.scene.primitives.add(tileset); | |
tileset.readyPromise.then(function(tileset) { | |
var date = new Date(); | |
date.setHours(10); | |
viewer.clock.currentTime = Cesium.JulianDate.fromDate(date); | |
viewer.camera.flyTo({ | |
destination: Cesium.Cartesian3.fromDegrees(-0.118092, 51.509865, 1000), | |
orientation: { | |
heading: Cesium.Math.toRadians(0), | |
pitch: Cesium.Math.toRadians(-45), | |
roll: 0.0 | |
} | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment