Skip to content

Instantly share code, notes, and snippets.

@skrat
Created November 16, 2016 00:29
Show Gist options
  • Save skrat/f8bc4c21f3405e968049acb4cee2bbaa to your computer and use it in GitHub Desktop.
Save skrat/f8bc4c21f3405e968049acb4cee2bbaa to your computer and use it in GitHub Desktop.
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : false,
selectionIndicator : false,
shadows : true
});
function createModel(url, height) {
viewer.entities.removeAll();
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
var heading = Cesium.Math.toRadians(135);
var pitch = 0;
var roll = 0;
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
var entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128,
maximumScale : 20000
}
});
viewer.trackedEntity = entity;
}
var options = [{
text : 'Aircraft',
onselect : function() {
createModel('http://localhost:31338/foox.glb', 3000.0);
}
}];
Sandcastle.addToolbarMenu(options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment