Created
November 16, 2016 00:29
-
-
Save skrat/f8bc4c21f3405e968049acb4cee2bbaa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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