Hello,
I add the model using the Entity API, But it don't running.
The Model (3D building) is Geo referenced and i want my Model run without add coordinate it to my code and that will use from defined coordinated of Model.
Please help me.
This is my code but my Model don't run :
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../templates/bucket.css);
</style>
</head>
<body>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script>
var viewer = new Cesium.Viewer('cesiumContainer', {
infoBox : true,
selectionIndicator : true,
shadows : true
});
function createModel(url, height) {
viewer.entities.removeAll();
var position = Cesium.Cartesian3.fromDegrees(51.319385, 35.768353, height);
var heading = Cesium.Math.toRadians(10);
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 : 50
}
});
viewer.trackedEntity = entity;
}
var options = [{
text : 'institute',
onselect : function() {
createModel('../../SampleData/models/CesiumGround/Institute-obj2.glb' , 500);
}
}];
Sandcastle.addToolbarMenu(options);
</script>
</body>
</html>
Thank you so much,